my_Perl
September 1, 2009, 11:24am
1
Hi all
I have seen many topics on file comparision. However, hardly any one match my problem.
I have two text files A.txt and B.txt . In each files, there are texts line by line. I want to compare these lines and print the lines to a third file which are not common in both the files. The lines may not be ended by fullstop (.) since these may be subsentences.
Any help is appreciated.
/usr/xpg4/bin/grep -v -f A.txt B.txt > C.txt
Source in russian
pdemong
September 2, 2009, 6:17am
6
I know a nice tool : diff3
It has more feature than diff and could help you.
drl
September 2, 2009, 7:19am
7
Hi.
DESCRIPTION
combine combines the lines in two files. Depending on the boolean
operation specified, the contents will be combined in different ways:
and Outputs lines that are in file1 if they are also present in file2.
not Outputs lines that are in file1 but not in file2.
or Outputs lines that are in file1 or file2.
xor Outputs lines that are in either file1 or file2, but not in both
files.
"-" can be specified for either file to read stdin for that file.
The input files need not be sorted ...
-- excerpt from man combine in Debian GNU/Linux 5
This is a useful utility compared to comm because there is no requirement for sorting.
The elimination of lines ending in full-stop may be done after the combine or as a preliminary step, say with a sed command like:
sed '/\.$/d'
cheers, drl