[ale] sed/awk/perl whatever question

Asher Vilensky ashervilensky at gmail.com
Tue Nov 3 14:40:56 EST 2009


I think that somebody asked the list a similar question recently, but I
couldn't find it.  Here's the deal:

I have two files:
file1 - contains unique strings:

123abc
234xyz
123456
kljdhs
etc

file2 is a huge log file with the unique numbers from file1 appearing in it
multiple times.  I need a script that for each unique string in file1, will
replace it in file2 with XXXX.  I did this on command line, but it didn't
work:

for i in `cat file`
do
sed -e 's/'"$i"'/XXXX/g' file2 >> file3
done


Or something like that.  The problem is that $i was not interpreted right.
Any advice anybody?  I'll take it in sed/awk/perl.

Thanks.

-- Asher
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.ale.org/pipermail/ale/attachments/20091103/27c843e0/attachment-0001.html 


More information about the Ale mailing list