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
You can try this
sed
command:Checking
GROUP something
without{
and back referencing it then replacing with\1 {
.With the following test file as
test.txt
:The following sed script does the business:
With the output looking like this:
Is that correct? What it does is look for lines which have tab->GROUP any characters but don't have { at the end. Replaces it with the matched line (that is what the & does) and appends a { afterwards.