Walt Mankowski on 23 Dec 2004 16:18:50 -0000 |
On Thu, Dec 23, 2004 at 07:55:04AM -0500, Michael D. Bevilacqua wrote: > > I did this creating a .t3mp file with the wanted output. > This was an extra step I took because I wasn't able to get > awk to write out to a file using '>', it would just create a > zero length file. What am I doing wrong? > > > for i in `grep -Frl 207.106.32.241 * | grep html$`; do awk '{ gsub("207.106.32.241", "ancss.org"); print }' $i >> $i.t3mp ; mv $i.t3mp $i; done One way to avoid the temp file is to use Perl instead of AWK: for i in `find . -name '*.html'`; do perl -pi -e 's/207\.106\.32\.241/ancss.org/g' $i; done This is also a bit more efficient since it's only reading each file once instead of twice as in your method. See perldoc perlrun for documentation on perl's -p and -i parameters. Walt Attachment:
signature.asc ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
|
|