I agree with MTK, this is not difficult and a solution has been presented to rename the objects.
Here is another alternative: Code:
while read -r line to move and perform sed then. |
Yeah, I want to rename files and change the contents that match certain patterns. Since I have many levels of directories; the contents changes are complex, I plan to use "sed -f" to do it. Any suggestion?
|
I am not sure I understand your most recent question? What suggestion do you require? The '-f' option
sounds fine if you already have the changes mapped out in a file. |
How about this:
Code:
while read file |
My question is how to use SED to change the contents of multiple files. The shell does allow me to use sed with both input and output are the same file as following:
sed 's/AA/ZZ/g' < $sourcefile > $sourcefile As to the script you suggested, it failed when I tried as followings: while read -r sfile do echo "sfile=$sfile" done<< ( find $1 -depth ) The error message is: line 4: syntax error near unexpected token '(' line 4: `done<< (find $1 -depth)` |
Quote:
Code:
sed -i 's/AA/ZZ/g' "$sourcefile" Quote:
Code:
done < <( Code:
done<< ( |
It works well. Thanks you MTK!!
|
All times are GMT -5. The time now is 01:07 AM. |