Re: Using one file to edit a second file.

"Davide Brini [email protected] [sed-users]" <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
On 03 Nov 2014 04:58:07 -0800, "[email protected] [sed-users]"
<[email protected]> wrote:

> Im sitting in class right now .. so I cant provide an example. 
> 
> But .. I have two files. 
> 
> FIle1
> 10.10.10.2
> 10.10.10.4
> 10.10.10.6
> 10.10.10.8
> 10.10.10.10
> 
> File2 
> 10.10.10.1
> 10.10.10.2
> 10.10.10.3
> 10.10.10.4
> 10.10.10.5
> 10.10.10.6
> 10.10.10.7
> 10.10.10.8
> 10.10.10.9
> 10.10.10.10
> 
> 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 
> 
> 10.10.10.1
> 10.10.10.3
> 10.10.10.5
> 10.10.10.7
> 10.10.10.9
> 
> 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. 

Not a sed solution, but far simpler:

grep -vxf file1 file2


-- 
D.
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.