Append to end of line sed / awk

awkscriptingsed

This is probably easy and something is not clicking for me and my lack of coffee right now.
I have a file with multiple lines that begin with a tab then the word GROUP something {

Some of these lines for whatever reason drop the curly bracket under some conditions. The quick fix is to use sed/awk to append the curly bracket to that line but not lines where the bracket already exist. I'm halfway there with but as you can see this will append the open curly bracket to every line that begins with a tab and GROUP.

sed '/[ \t]GROUP/ s/$/ {/' scst.conf.test > greg.scst.out

Best Answer

You can try this sed command:

$ sed '/[ \t]GROUP/ s/{*$/ {/' scst.conf.test > greg.scst.out