Re: Using one file to edit a second file.

"Ronaldo Ferreira de Lima [email protected] [sed-users]" <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <20141103162738.GA1185@textmode>
Greetings,

On Mon, Nov 03, 2014 at 04:58:07AM -0800, [email protected] [sed-users] wrote:
> Im sitting in class right now .. so I cant provide an example.
> 
> But .. I have two files.
> 
> FIle1
[...]
> 
> File2
[...]
> 
> I want to use file one to search file two. If ips in file one are matched in
> file2, I want to delete them and write a file of non matched ips
[...]
> 
> ofcourse there are special considerations 10.10.10.1, 10.10.10.10, 10.10.10.100
> .. need exact matches.
> 
> I could do with is if or case statements .. but just wondering if sed can do
> it.
The best way isn't sed-script. But, if you really want do this in sed,
you can try build a dinamic sed-script like:

    $ sed -f <(sed 's/^/\/^/;s/$/$\/d/' file1.txt) file2.txt

> THanks for the help.

[]'s
-- 
"Não manejo bem as palavras
Mas manipulo bem as strings."
------------------------------
http://tecnoveneno.blogspot.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.