Last active
August 29, 2015 14:13
-
-
Save edwtjo/fe4c35fa6b12947d13cb to your computer and use it in GitHub Desktop.
Cleanup display names (VCF entries)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/awk -f | |
# Purges and regenerates contact book display names | |
# Delete current contact display name | |
!/^N:/ | |
# Generate a new contact display name on the form: | |
# N:LASTNAME_1;FIRSTNAME_1;..;FIRSTANME_n;LASTNAME_2;..;LASTNAME_m;;; | |
/^FN:.*/{ | |
n=n+1; | |
name=substr($0,4); | |
split(name,narr," "); | |
name2=narr[length(narr)]; | |
for (i=1; i<=length(narr)-1; i++) name2 = name2";"narr[i] | |
print "N:"name2";;;"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment