I want to delete a particular string ( ex : berkely@abc.com ) from different locations and in different files in each location.
Please help me !
I want to delete a particular string ( ex : berkely@abc.com ) from different locations and in different files in each location.
Please help me !
# command to get rid of data
sed '/berkely@abc.com //g' <in_file >out_file
# over-write original file
cp out_file in_file
From that, you could build a loop or loops to cycle thru your files. You did not specify filenames or directories, therefore that could not be included.
you can use "sed -i" (-i, edit files in place)
sed -i -e 's/some-string//' inputfile
BTW, Solaris version of sed does not support -i
Kindly check the following script
#!/bin/bash
for i in `ls`
do
sed 's/stringname//' $i >$i,
mv $i, $i
done
If u want delete the string from different locations u have to use ls followed by path of the directory.
That's a Useless Use of ls -- you're better off simply with for i in *