Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.49 KB | None | 0 0
  1. echo "user_name;card_number;policy_number;ext_ref_number;provider_id;group_code;activation_id;last_login_dttm;registration_dttm;activation_dttm;activation_notes;rejection_notes;reference_number;mobile_number;activation_status_id;email_address;mobile_activation_code;mobile_activation_status;mobile_last_login_dttm;mobile_login_count;country_code;source;emirates_id;smartpass_uuid;first_name;last_name;user_password" >Thiqa_users_online.withPasswords.csv && \
  2. li=0 && \
  3. for rawline in $(sed s/' '/'_______'/g Thiqa_users_online.csv); do
  4.     line=$(echo ${rawline} | sed -e s/'[\n\r]'//g)
  5.     if [ ${li} -ne 0 ]; then
  6.         if [ ${#line} -gt 180 ]; then
  7.             username=$(echo ${line} | sed -r s/'^([^;]+);.+'/'\1'/g)
  8.             if [ $(echo ${username} | grep -iv "_______" | wc -l) -gt 0 ]; then
  9.                 password=$(grep -A 5 "uid: ${username}" Thiqa_users_PRd_NOPASSWORD.ldif | grep -i userPassword | sed s/'userPassword: '/''/g)
  10.                 if [ ${#password} -gt 1 ]; then
  11.                     echo "${line};${password}" | sed s/'_______'/' '/g >>Thiqa_users_online.withPasswords.csv
  12.                 else
  13.                     echo "${line};" | sed s/'_______'/' '/g >>Thiqa_users_online.withPasswords.csv
  14.                 fi
  15.             else
  16.                 echo ${line} | sed s/'_______'/' '/g >>Thiqa_users_online.withPasswords.csv
  17.             fi  
  18.         else
  19.             echo ${line} | sed s/'_______'/' '/g >>Thiqa_users_online.withPasswords.csv
  20.         fi
  21.     fi
  22.     li=$[li+1]
  23. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement