COMM(1) BSD General Commands Manual COMM(1)NAME
comm -- select or reject lines common to two files
SYNOPSIS
comm [-123i] file1 file2
DESCRIPTION
The comm utility reads file1 and file2, which should be sorted lexically, and produces three text columns as output: lines only in file1;
lines only in file2; and lines in both files.
The filename ``-'' means the standard input.
The following options are available:
-1 Suppress printing of column 1, lines only in file1.
-2 Suppress printing of column 2, lines only in file2.
-3 Suppress printing of column 3, lines common to both.
-i Case insensitive comparison of lines.
Each column will have a number of tab characters prepended to it equal to the number of lower numbered columns that are being printed. For
example, if column number two is being suppressed, lines printed in column number one will not have any tabs preceding them, and lines
printed in column number three will have one.
The comm utility assumes that the files are lexically sorted; all characters participate in line comparisons.
ENVIRONMENT
The LANG, LC_ALL, LC_COLLATE, and LC_CTYPE environment variables affect the execution of comm as described in environ(7).
EXIT STATUS
The comm utility exits 0 on success, and >0 if an error occurs.
SEE ALSO cmp(1), diff(1), sort(1), uniq(1)STANDARDS
The comm utility conforms to IEEE Std 1003.2-1992 (``POSIX.2'').
The -i option is an extension to the POSIX standard.
HISTORY
A comm command appeared in Version 4 AT&T UNIX.
BSD December 12, 2009 BSD
Check Out this Related Man Page
COMM(1) BSD General Commands Manual COMM(1)NAME
comm -- select or reject lines common to two files
SYNOPSIS
comm [-123f] file1 file2
DESCRIPTION
The comm utility reads file1 and file2, which should be sorted lexically, and produces three text columns as output: lines only in file1;
lines only in file2; and lines in both files.
The filename ``-'' means the standard input.
The following options are available:
-1 Suppress printing of column 1.
-2 Suppress printing of column 2.
-3 Suppress printing of column 3.
-f Fold case in line comparisons.
Each column will have a number of tab characters prepended to it equal to the number of lower numbered columns that are being printed. For
example, if column number two is being suppressed, lines printed in column number one will not have any tabs preceding them, and lines
printed in column number three will have one.
comm assumes that the files are lexically sorted; all characters participate in line comparisons.
EXIT STATUS
comm exits 0 on success, >0 if an error occurred.
SEE ALSO cmp(1), diff(1), sort(1), uniq(1)STANDARDS
The comm utility conforms to IEEE Std 1003.2-1992 (``POSIX.2'').
BSD June 6, 1993 BSD
This may be the 3rd time I'm posting this question. I'm so new here that I'm not even sure how to post!
I'm trying to compare two files but can't do a line by line comparison so comm and diff are out. I've been told that I would need to use the awk programing language. I've looked up what I... (14 Replies)
Hello
I need to sort a file with data such as so it breaks on column 1 and all the data in column 2 is sorted into rows with a unique column 1:
1 5
1 6
1 7
2 3
2 4
3 7
3 0
3 9
So it comes out as:
1 5 6 7
2 3 4
3 7 0 9
I've tried many iterations of nawk but can't get it... (14 Replies)
I have to compare two text files, very few of the lines in these files will have some difference in some column.
The files size is in GB.
Sample lines are as below:
11111122222222333333aaaaaaaaaabbbbbbbbbccccccccdddddd
11111122222222333333aaaaaaaaaabbbbbbbbbccccccccddeddd
So assuming these... (19 Replies)
Hi Guys...
Please Could you help me with the following ?
aaaa bbbb cccc sdsd
aaaa bbbb cccc qwer
as you can see, the 2 lines are matched in three fields...
how can I delete this pupicate ? I mean to delete the second one if 3 fields were duplicated ?
Thanks (14 Replies)
I need to add "new lines" of text with special characters, to specific lines in the file. There are 3 modifications needed. Been testing 2 here without success.
#!/usr/bin/perl
use FileHandle;
$file=FileHandle->new;
$FILENAME="/opt/etc/usr/file.txt";
$file->open ("<$FILENAME") or die... (13 Replies)
Hi Experts,
I have a file format as mentioned below. I would like to have unix script (HP Unix) which can:
1. Remove first 6 and last 3 lines.
2. Delete the lines where 3rd column having Alpha Numeric Number
3. Delete the lines where 4th column having 0.00
4. Calculate the sum of all the... (16 Replies)
I have a table to data which one of the columns include string of text
from within that, I am searching to include few lines but not others
for example I want to to include some combination of word address such as (address.| address? |the address | your address) but not (ip address | email... (17 Replies)
hi,
i have a file with many records and each record may or may not have 6 columns.
for example
file1 :
first second third fourth fifth sixth
first second third fourth fifth
first second third fourth fifth sixth
first second third fourth fifth sixth seventh eigth
if i cat the file and... (21 Replies)
I have two files, want to compare file1 data with file2 second column and print line which are not matching. Need help in matching the pattern, file2 second column number can be leading 0 or 00 or 000.
Example:
file1
1
2
3
file2
a,0001
b,02
c,000
d,01
e,2
f,0005
Expected output:... (20 Replies)
#cat data.txt
file1 folder1
file2 thisforfile2
file3 thisfolderforfile3
lata4 folder4
step 1: create the folder first in column 2
for i in `awk '{print $2}' data.txt`
do
mkdir /home/data/$i
done
step 2: locate the files in column1 and stored them into a file
for i in... (17 Replies)
Could it be possible to find common lines between all of the files in one folder? Just like comm -12 . So all of the files two at a time. I would like all of the outcomes to be written to a different files, and the file names could be simply numbers - 1 , 2 , 3 etc. All of the file names contain... (19 Replies)
I have two files, file1 and file2 who have identical number of rows and columns. However, the script is supposed to be used for for different files and I cannot know the format in advance. Also, the number of columns changes within the file, some rows have more and some less columns (they are... (13 Replies)
Hello all, First post here. I did not notice a previous post to help me down the right path. I am looking to compare a column in a CSV file against another file (which is not a column match one for one) but more or less when a match is made, I would like to append a third column that contains a... (17 Replies)