![]() |
| ||
| Replace text in a file Greetings, Hey guys, I am trying to make a shell script that will scan for a certain 5 lines of text in a file, modify it by adding two lines in the middle and replacing that section of text in the file. For example read rc.conf for: Line1 Line2 Line3 Line4 Line5 That match the exact lines and replace that section or match with Line1 Line2 INSERTLINE Line3 INSERTLINE Line4 Line5 Mainly i am trying to add a new case statment inside an if loop automatically using a shell script. I have tried reading info on awk usage but cannot find anything that matches whta I am trying to accomplish. Any help would be greatly appreciated. Regards, S Tompkins |
| ||
| Re: Replace text in a file Here's one way of approaching your problem (pseduo-code): while !eof {Just off the top of my head. Don't take it too literally. |
| ||
| Re: Replace text in a file awk works for this pretty well - awk '{ |
| ||
| Re: Replace text in a file sed ' |
| All times are GMT -4. The time now is 6:23 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC