Michael D. Bevilacqua on 27 Dec 2004 18:23:47 -0000 |
On Mon, Dec 27, 2004 at 08:14:10AM -0500, Jon Nelson wrote: > Just out of curiosity did that last awk statement work for > you or did you not try it? Hey Jon, Actually, yes you did. When I first tried it[1], it created those .txt.tmp files which confused me a little since I was trying to rid of that creation of tmp files step. But then I noticed how the syntax varied, and gave this a shot which worked: for i in `grep -Frl 207.106.32.241 * | grep html$`; do awk '{ gsub("207.106.32.241","ancss.org"); print > FILENAME}' $i ; done This should search for all instances of that IP recursively from the current working directory, take only the filenames ending in html, and run that awk code which globally replaces the IP with the host within the file, which was all I wanted :-D Turns out I was just misunderstanding the usage of the 'FILENAME' file handle in the original[2]. Thanks! [1] awk '{ gsub("207.106.32.241","ancss.org"); print > FILENAME ".tmp"}' *.html [2] 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 -- Regards, Michael D. Bevilacqua ~ . . /V\ michael@bevilacqua.us // \\ /( )\ ^`~'^ Attachment:
pgpjWuXtOIlpR.pgp ___________________________________________________________________________ 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
|
|