Hi,
The following command appends the contents of myfil.txt to each *.scr file in each folder under the directory maindir.
My question is, how can we "find and replace a string" in all the *.SCR files in each subdirectory under MAINDIR?
For example if I have a main directory MAINDIR, and lot of sub-folders within MAINDIR which contain a *.scr file, then how do I find a particular line that has a string "IT'S ME" and replace it with "ARE U THERE" in that line.?
Thanks,
RV
The following command appends the contents of myfil.txt to each *.scr file in each folder under the directory maindir.
Code:
find maindir -name '*.scr' | while read f; do cat /path/to/myfil.txt >> "$f"; done
My question is, how can we "find and replace a string" in all the *.SCR files in each subdirectory under MAINDIR?
For example if I have a main directory MAINDIR, and lot of sub-folders within MAINDIR which contain a *.scr file, then how do I find a particular line that has a string "IT'S ME" and replace it with "ARE U THERE" in that line.?
Thanks,
RV