This is line one,
this is another line,
this is the PRIMARY INDEX line
l ;
This is another line
The command should find the line with �PRIMARY INDEX� and remove the last character from the line preceding it (in this case , comma) and remove the first character from the line following it (in this case l )
The output should look like:
This is line one,
this is another line
this is the PRIMARY INDEX line
;
This is another line
Thank you for your quick respose. It almost works.
The only problem is it replaces the last line with the line before the matching line at the end. The two lines "this is another line" in my previous sample are not always the same (I should have used different lines).
For example if the sample file is:
This is line one,
this is another line
this is the PRIMARY INDEX line
;
this is yet a different line
That command produces:
This is line one,
this is another line
this is the PRIMARY INDEX line
;
this is another line
This replaces the "this is yet a different line" with "this is another line". Is there a way to modify the awk command to not replace the last line?