Created
July 9, 2015 23:39
-
-
Save albert-decatur/8ce0bc543e1c3874901a to your computer and use it in GitHub Desktop.
get names in last, first, suffix order
This file contains hidden or 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
cat civil.csv |trim | parallel 'last=$(echo {} | grep -oE "[^ ]+$" ); if [[ -n $( echo "$last" | grep -iE "jr|sr|ii+") ]]; then suffix="$last"; name=$( echo {} | sed "s:[^ ]\+$::g;s: \+$::g" ); last=$( echo "$name" | grep -oE "[^ ]+$" ); first=$( echo "$name" | sed "s:[^ ]*$::g" ); else first=$( echo {} | sed "s:[^ ]*$::g" ); fi; echo "$last,$first,$suffix"' | trim |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment