[ale] sed/awk/perl whatever question

scott scott at sboss.net
Tue Nov 3 14:53:47 EST 2009


Give me a few and I will send you a perl script that will do that for  
you... Very simple in Perl.

On Nov 3, 2009, at 2:40 PM, Asher Vilensky wrote:

> 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 
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo



More information about the Ale mailing list