Last active
August 2, 2018 18:44
-
-
Save packetpilot/e26eee3013446dc4db1ad7f83ae492d5 to your computer and use it in GitHub Desktop.
[bash] Convert an ALL CAPS list (or csv etc) to Just First Letter Capitalized
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
bash-4.4$ cat CAPSTITLES | |
SR IMPORTANT PERSON | |
JR SOMETHING OTHERTHING | |
DIR JANITORIAL | |
HEAD OF ALL NECKS | |
PLEB | |
SEÑOR DIVERSITY ADVOCATE | |
SR. PERIOD TESTER | |
LEAD, PUNCTUATION TESTERS | |
WOULD,THIS,WORK,ON,A,CSV? | |
# this is a one-liner that's been split for readability. | |
bash-4.4$ while IFS='' read TITLE || [[ -n "${TITLE}" ]]; \ | |
do echo "${TITLE,,}"; done < CAPSTITLES \ | |
| sed -e "s/\b\(.\)/\u\1/g" > LessShoutyTitles | |
bash-4.4$ cat LessShoutyTitles | |
Sr Important Person | |
Jr Something Otherthing | |
Dir Janitorial | |
Head Of All Necks | |
Pleb | |
Señor Diversity Advocate | |
Sr. Period Tester | |
Lead, Punctuation Testers | |
Would,This,Work,On,A,Csv? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment