help on sed# Unix - 噫吁兮,危乎高哉
i*f
1 楼
Hi,
Today when I try to replace a string in many files, first
I tried to use "sed -e s/STRING1/STRING2/g *" and only found
out the replaced pattern was output to STDOUT. At last I have
to write a script like this:
#/bin/sh
for fn in *
do {
sed -e s/STRING1/STRING2/g $fn > out.tmp
cp -f out.tmp $fn
}
done
rm -f out.tmp
Anyone can suggest to do the same function by using only one
line?
Today when I try to replace a string in many files, first
I tried to use "sed -e s/STRING1/STRING2/g *" and only found
out the replaced pattern was output to STDOUT. At last I have
to write a script like this:
#/bin/sh
for fn in *
do {
sed -e s/STRING1/STRING2/g $fn > out.tmp
cp -f out.tmp $fn
}
done
rm -f out.tmp
Anyone can suggest to do the same function by using only one
line?