And people wonder why I love Unix/Bash. I had to combine a few different files yesterday that had email addresses, but with different delimiters and a bunch of dupes. This basically goes through those files, standardizes the delimiters, sorts it in a fashion to get find the emails with the most info, uniq’s out the dupes, and then reorders it into a csv file.

Schwag.

{% codeblock %}sed ’s/:/,/g’ Email\ List.txt | tr -d “’” | sort -r | awk -F, ‘{print $2"\t__"$3"\t__"$1}’ | sed ’s/^[ ^t]//;s/[ ^]$//’ | uniq -f2 | tr -d “__” | sort | tr “\t” “,” > Emails.csv {% endcodeblock %}