Can U help me plzz....
Hi all,
I'm new a member. I'm doing on linux. I want to write a linux shell script to insert 2 lines in middle of a file. My requirement is ***Serch for a line, then insert 2 lines after that line*** Ex: I hav a file called abc. ******FileName: abc****** Bug:1000 Bug:1010 Bug:1020 Bug:1030 Bug:1040 Bug:1050 ************************** I want to insert following lines Bug:1033 Bug:1039 Final o/p should be as ******FileName: abc****** Bug:1000 Bug:1010 Bug:1020 Bug:1030 Bug:1033 Bug:1039 Bug:1040 Bug:1050 ************************* First i need to search for line "Bug:1030", then i need to insert 2 new lines after that. Already i written a perl script to do same. but i need shell script also. Thanks, Bhargav...... |
Hi. May be this
Code:
sed '/pattern/a\Bugz:1033\a\\n\a\Bugz1039' |
Thank You. I revisited 'sed' after long time, and got it. :-)
|
All times are GMT -5. The time now is 04:02 PM. |