Script for file editing.

[Closed]
Report
-
 avatar12 -
Hello,
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.
Avatar

1 reply

Posts
2
Registration date
Tuesday June 2, 2009
Status
Member
Last seen
June 23, 2009

find /path -type f -name "control" | while read FILE
do
     sed -i.bak "s/old/new/g" $FILE
done

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.