I am writing a bash script to automatically generate some other files, and I have to format some strings a certain way. Specifically, the last problem I'm having is formatting a string that has individual capital letters and a word that starts with a capital letter. For example:
O S D Settings
needs to become OSD Settings
I have a sed command that strips the first space, but it also deletes the "D" (i.e. O S D Settings
-> OS Settings
). This command is:
O S D Settings | sed 's/ \([A-Z]\)* \(A-Za-z]*\)/\1/g'
Does anyone know how to delete the spaces in between individual capital letters without losing any letters?