Editing files to add some thing in all the files in a folder

Hi All,

I have a folder that contains 100's of files and each file have a similar content like the following format:

((STBJa:200.0,((STBTz:200.0,(STSwe:200.0,(STDUw:200.0,(ST4Bu:200.0,STL2b:200.0):127.0):86.0):80.0):120.0,
STAHr:200.0):134.0):200.0,STuNg:200.0);

What I need is to do is add "#1" after a specified word (say STAHr) in all the files in the folder. An example of the resulting file will be:

((STBJa:200.0,((STBTz:200.0,(STSwe:200.0,(STDUw:200.0,(ST4Bu:200.0,STL2b:200.0):127.0):86.0):80.0):120.0,
STAHr #1 :200.0):134.0):200.0,STuNg:200.0);

I need to specify the word (ex ST4BU) on the script and then add " #1 " (not that #1 is should have a space on both sides)

Please let me know the best way in awk or sed that could implement this in all the files in a folder. At one time I will only have to add #1 to only one word.

Please let me know.

LA

Try:

var=STAHr
perl -i -ne 's/'$var'/'$var' #1 /g;print;' *

Try this:

for file in *.txt
do
sed 's/STAHr/STAHr #1 /1' $file > /logs//file1.txt
mv /logs/file1.txt $file
done