Re: How to compare two text files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Donnerstag, den 06.05.2010, 18:27 +0530 schrieb W.H. Kalpa Pathum:
> I've got two text files containing email addresses one at a row. The
> number of rows in one file is different from the number of the other
> file. email addresses in one file is already there in the other file
> (there are some more also). What I want to do is extract the list
> which is not in the other file.
> 
> elaboration
> 
> File A has 100 email addresses and file B has 15 email addresses. 15
> email addresses in file B are already there in file A. I want to
> extract the 85 mails (excluding the 15 from file B) from file A.

First, files must have the same pattern form, and be sorted (I assume
you don't have "bill@xxxxxx" in file1 and "Bill <bill@xxxxxx>" in file2)

sorting:
$ sort file1>file1.sort
$ sort file2>file2.sort

Show what file1.sort contains but avoid entries in file2.sort:
$ grep -f file2.sort -v file1.sort

visual differences
$ diff --side-by-side file1.sort file2.sort

Greets!
----------------------------------------------
Rodolfo Alcazar Portillo - nospaze@xxxxxxxxx
otbits.blogspot.com / counter.li.org: #367962
----------------------------------------------
> hence the AIX boxen of increasing power [...]
That phrasing reminded me of "Rodents of Unusual Size".
-- Mike and Greg Andrews


-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux