Script for file editing.

avatar12 - Jun 22, 2009 at 08:59 AM
 avatar12 - Jun 28, 2009 at 01:56 PM
I need to make a script that will edit a file name "control" in multiple folders. The first part is how to access multiple folders (How to choose the folder and how to access). The second part is to replace certain lines in the folder with certain pattern then write a file that will overwrite the old one. Thanks in advance.

1 reply

ghostdog74 Posts 2 Registration date Tuesday June 2, 2009 Status Member Last seen June 23, 2009
Jun 23, 2009 at 01:19 AM
find /path -type f -name "control" | while read FILE
     sed -i.bak "s/old/new/g" $FILE

I try your script but this message "Expected end of line but found identifier." pop up with letter f highlighed in the script. I don't know why . Please explain. Thanks.