Advanced replace

Hello,

How can I replace the following with null from a file

";var "d=e";"^x"

replace "";var "d=e";"^x"" "" -- filename ; doesnot work nor if I use \ in between.

Please advise.

Thanks

Try :

sed 's/";var "d=e";"^x"//g' inputfile > outputfile

Jean-Pierre.

The above sed command trick doesnot work... the string still remains in the outfile.

The above sed command by Jean-Pierre is actually working... my apologies..

how can I run the command for a list of 1000 files whose path has been save to a fixle say xyz

You can do something like that (not tested) :

while read file
do
   sed 's/";var "d=e";"^x"//g' $file > $file.tmp && mv $file.tmp $file
done < input_file_list

Jean-Pierre.

Hello,

sed 's/";var "d=e";"^x"//g' file

is working fine but... the script for mass replace it not.

I have the list of files whihc has the string in a file say .. input_file_list

Please can you test the script.

Thanks.

The file input_file_list contains the list of files to proceed

Jean-Pierre.

Hello,

Inderstand that
input_list_file = /home/frm.txt

root@server [~]# head /home/frm.txt
/home/user/public_html/includes/tiny_mce/tiny_mce.js
/home/user/public_html/includes/tiny_mce/blank.htm
/home/user/public_html/includes/tiny_mce/tiny_mce_src.js
/home/user/public_html/includes/tiny_mce/plugins/advimage/image.htm
/home/user/public_html/includes/tiny_mce/plugins/advhr/rule.htm
/home/user/public_html/includes/tiny_mce/plugins/table/row.htm
/home/user/public_html/includes/tiny_mce/plugins/table/cell.htm
/home/user/public_html/includes/tiny_mce/plugins/table/table.htm
/home/user/public_html/includes/tiny_mce/plugins/emotions/emotions.htm
/home/user/public_html/includes/tiny_mce/plugins/searchreplace/search.htm

Please advise.

Thanks.

root@server [~]# cat /root/y
while read file
do
sed 's/";var "d=e";"^x"//g' $file > $file.tmp && mv $file.tmp $file
done < /home/frm.txt
root@server [~]#

root@server [~]# /root/y
/root/y: line 3: $file.tmp: ambiguous redirect
/root/y: line 3: $file.tmp: ambiguous redirect
/root/y: line 3: $file.tmp: ambiguous redirect
/root/y: line 3: $file.tmp: ambiguous redirect
/root/y: line 3: $file.tmp: ambiguous redirect
/root/y: line 3: $file.tmp: ambiguous redirect
/root/y: line 3: $file.tmp: ambiguous redirect
/root/y: line 3: $file.tmp: ambiguous redirect
/root/y: line 3: $file.tmp: ambiguous redirect
/root/y: line 3: $file.tmp: ambiguous redirect

Hello,

for x in `cat /home/frm.txt` ; do sed 's/";var "d=e";"^x"//g' $x > /opt/1 ; mv -f /opt/1 $x ; done

did the trick.

Thanks,

Try :

sed 's/";var "d=e";"^x"//g' $file > ${file}.tmp && mv ${file}.tmp $file

Jean-Pierre.