Linux commThe 'comm' command compares two files or streams. By default, 'comm' will always display three columns. First column indicates non-matching items of first file, second column indicates non-matching items of second file, and third column indicates matching items of both the files. Both the files has to be in sorted order for 'comm' command to be executed. Syntax: Example: Look at the above snapshot, First column displays non-matching items of first file 'file1.txt' (Sehwag, Yuvi) Second column displays non-matching items of second file 'file2.txt' (Zadeja) Third column indicates matching items of both the files (Dhoni, Dravid, Sachin) To Display Single ColumnIf you want to output a single column, you have to specify number of the columns which are not to be displayed. Syntax: comm -23 comm -13 comm -12 Example: comm -23 file1.txt file2.txt comm -13 file1.txt file2.txt comm -12 file1.txt file2.txt Look at the above snapshot, column number which needs to be displayed are not mentioned in the 'comm' command. Next TopicLinux sed |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India