Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- id emails
- 1 jeff@email.com
- 2 larry@email.com
- 3 jprice@email.com,jeff@email.com,jeff@stacko.com
- id emails
- 1 jeff@email.com
- 2 larry@email.com
- 3 jprice@email.com,jeff@stacko.com
- jeff@email.com
- larry@email.com
- jprice@email.com,jeff@email.com,jeff@stacko.com
- awk -F, '{ COMMA="";i=0; while (++i<=NF) {
- $1=$i; printf (!seen[$1]++)?COMMA$i:""; COMMA=","}; print ""
- }' infile.csv
- jeff@email.com
- larry@email.com
- jprice@email.com,jeff@stacko.com
- awk 'NR==1; NR>1{id=$1"t"; COMMA=$1="";split($0, ar, /,| /);
- for(i in ar){if(ar[i]){printf(!seen[ar[i]]++)?id""COMMA""ar[i]:""; COMMA=",";id=""}
- } print ""}' infile
- id emails
- 1 jeff@email.com
- 2 larry@email.com
- 3 jprice@email.com,jeff@stacko.com
Add Comment
Please, Sign In to add comment