Alex Rivera | Logout

replacing multiple line pattern in sed

Asked 2011-11-17T09:11:53.857
11

I simply want to do following

replace

EXTRATHING {
};

by

SOMETHING {};

in inputfile. For this, I tried

sed -e 's/EXTRATHING {\n};/SOMETHING/' input_file.txt  >outfile.txt

This doesn't work. Can someone suggest what would be the correct way of doing this with sed?

sed
Edit
Report

1 Answer

3
 sed -i.bak '/EXTRATHING/{N;s//SOMETHING/;s/\n//}' input_file.txt
answered 2013-04-29T09:33:23.500

Your Answer