| Newsgroups |
gmane.editors.sed.user |
| Message-ID |
<[email protected]> |
If each line holds ony one IP and no add. spaces:
sed -f <(sed 's|.*|/&$/d|' file1) file2
It will delete every IP found in file1 in file2
On November 3, 2014 2:58:07 PM EET, "[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.
>
>THanks for the help.
>
>[Non-text portions of this message have been removed]
>
>
>
>------------------------------------
>Posted by: [email protected]
>------------------------------------
>
>--
>
>------------------------------------
>
>Yahoo Groups Links
>
>
>
--
Sent from my FairPhone. Please excuse my brevity.
[Non-text portions of this message have been removed]