If I have a list of data in a text file seperated by a new line, is there a way to append something to the start, then the data, then append something else then the data again?
EG a field X would become new X = X;
Can you do this with bash or sed or just unix tools like cut?
EDIT:
I am trying to get ‘ITEM_SITE_ID :{$row[‘ITEM_SITE_ID’]}
‘ .
I am using this line awk ‘{ print ‘\”$1 ‘ {:$row[‘$1’]}
‘ }’
And I get this ‘ITEM_SITE_ID {:$row[]}
What have I missed?
I think the problem is your single quotes are not properly escaped, which is actually impossible to do.
With sed:
Or in your case:
And with bash:
And actually you can do it in awk using bashes $” strings: