Questions tagged [comm]

For questions pertaining to comm, a utility to select or reject lines common to two files.

Filter by
Sorted by
Tagged with
1 vote
0 answers
25 views

When should I use comm over diff?

It seems diff can do anything comm can do? When should I use comm only but not diff excepting the difference in result format? I guess comm is faster?
tom10271's user avatar
  • 111
0 votes
1 answer
32 views

comm issues displaying desired results

I learned here how to use comm to compare 2 already sorted (using sort) files and display lines/records present in either one of the files or in both of them. Something is actually not really working ...
darwingoat's user avatar
0 votes
1 answer
43 views

diff and comm are not finding difference between two env files

I have this env file 1.env contents: BARF_BAG=1 then another env file: 2.env contents: BARF_BAG=2 I run comm and diff on the files to see the difference: #!/usr/bin/env bash ( set -e; ...
Alexander Mills's user avatar
0 votes
1 answer
43 views

Group results using comm

Using comm I get results that look weird from this: comm -3 <(. "$first_env_file"; env) <(. "$second_env_file"; env) I get something like: AUTH_LP_ACCOUNT_ID=xxx1 ...
Alexander Mills's user avatar
-1 votes
1 answer
154 views

I need to compare/sort two text files

this is the scenario. I have File1 and File2 and i like to have the outcome in File3. I'm kind of new to Linux, but so far ive tried to use sort, diff, and comm. but no luck so far. File1.txt File2....
conny's user avatar
  • 1
1 vote
3 answers
912 views

Recursively list path of files only

Why I have two folders that should contain the exact same files, however, when I look at the number of files, they are different. I would like to know which files/folders are present in one, not the ...
Olaf's user avatar
  • 113
0 votes
1 answer
214 views

Comparing Sets with 'comm' [duplicate]

Trying to get a list of available IP addresses based off all usable IPs in a range when compared to a device's ARP table. Basing what I'm doing with comm on this discussion: Intersection of two arrays ...
rannday's user avatar
  • 11
1 vote
3 answers
789 views

How to get the difference between files

I've found other links on the stackoverflow communities that were similar but they didn't answer my question exactly. I have 2 files with a different number of lines BUT I have them both sorted. My ...
Classified's user avatar
1 vote
2 answers
31 views

How to get well-formed table from comm?

I want to use the output of comm in other table parsers. However it seems like it produces inconsistently delimited rows. For example: $ comm <(echo "1\n2") <(echo "2\n3") | ...
Haterind's user avatar
  • 169
0 votes
2 answers
137 views

get only the unmatched list as an output

I want to know on which ports of firewalls from a particular customer the MAC Address Filtering is not active. So I have created 2 files: all.txt contains a list of all firewalls of a customer and ...
Ella Widya's user avatar
3 votes
2 answers
99 views

comm for n files

I am looking for comm's functionality for n, i. e. more than two, files. man comm reads: COMM(1) NAME comm - compare two sorted files line by line SYNOPSIS comm [OPTION]... FILE1 FILE2 ...
Julia's user avatar
  • 31
1 vote
1 answer
2k views

How do I find duplicate lines in multiple files within folders

when i want to find duplicate lines between two files i use this command comm -12 <(sort file1.txt) <(sort file2.txt) or sort file1.txt file2.txt | awk 'dup[$0]++ == 1' But, how do I find ...
acgbox's user avatar
  • 951
1 vote
2 answers
2k views

Compare two files based on first column

I have two files, and I would like to get a new file with only the lines that we have in the first file, but not in the second one. Example: file1: ID firstname lastname 1 John ...
jazonpanczel's user avatar
1 vote
0 answers
92 views

Comm requires --nocheck-order on ~10.000 lines file?

I want to use Comm to compare two log files. The files are around 1MB containing ~10.000 lines. While testing with a small portion of a log comm -1 -3 a.log b.log > diff.log worked as expected. ...
sjaak's user avatar
  • 584
-1 votes
4 answers
100 views

Compare two files and generate another on matching condition

I have two files, a.txt and b.txt, where a.txt contains lines starting with "zn", e.g., zn12c5b or  zn4i8l, while b.txt contains lines ending with a pattern "/number", e.g., t17v11/...
lina32's user avatar
  • 47
2 votes
5 answers
986 views

how to find common number from multiple file?

I want to extract common number present in all file. I have 1000 file in folder. I Want to compare all file number and find out common number in 1000 file. I have used below code: for ((i=2;i<=...
claudia smith's user avatar
0 votes
4 answers
320 views

Need identical lines from file2 which are present in file1

File1 contains numbers each per line (0 to 9 digit length) total records 20k File2 contains numbers(0 to 9 digit) in first column and other info in each line,total recs 46 ,000,00 Both files are ...
kcmakwana's user avatar
2 votes
1 answer
4k views

bash remove common lines from two files

I have two files, (no blank lines/Spaces/Tabs) /tmp/all aa bb cc hello SearchText.json xyz.txt /tmp/required SearchText.json and the end output I want is : (all uncommon lines from /...
Girish's user avatar
  • 123
2 votes
4 answers
1k views

How to find the intersection of multiple files (not necessarily two files)?

I'd like to write a simple script for finding the intersection of multiple files (the common lines among all files), so after reading some here (link) i tried to write a bash script, which ...
JammingThebBits's user avatar
0 votes
1 answer
181 views

Can I merge-sort two sorted files by using comm?

comm assumes its two inputs are sorted. Is it correct that it works in the same way as the merge sort algorithm? If yes, can I use comm to merge-sort two sorted files? Thanks.
Tim's user avatar
  • 102k
-3 votes
2 answers
235 views

What do comm and diff try to accomplish at input/output level?

Given two files, for each line in each file, how do comm and diff determine whether the line also occur in the other file? if it does, whether its occurrences in the two files are the same or ...
Tim's user avatar
  • 102k
0 votes
1 answer
53 views

Printing in one line the common text using comm cmd?

I have 2 files that contain numbers_ID, status, descrpation I want to join both files based on the numbers as number_123, status1, status2 My file 1: number_123,this car is under maintenance ...
Lona gracia 's user avatar
0 votes
1 answer
90 views

Print only what is exclusive to a file compared to another in Bash

Good day everyone, I know there are a lot of similar questions already answered, but I can't find a satisfying answer and it drives me nuts. I have two files which both contain hostnames : one that ...
Alistair Wallace's user avatar
1 vote
3 answers
2k views

Linux equivalent of windows cmd command

I'm migrating to Linux, and I need to convert the following Windows cmd command: fc file1.txt file2.txt | find /i "no se han encontrado diferencias" > nul && set equal=yes I think fc can ...
kurokirasama's user avatar
0 votes
2 answers
297 views

Comparing Data between 2 different files in Unix

I have 2 different files- File 1 2 4 6 8 10 12 File 2 2 3 5 6 10 12 I want to compare 2 files and get the output data which is in File 1 but not in File 2- Output 4 8 I am using below command ...
Praveen Verma's user avatar
1 vote
1 answer
341 views

Using comm with NULL-terminated records

Over in an answer to a different question, I wanted to use a structure much like this to find files that appear in list2 that do not appear in list1: ( cd dir1 && find . -type f -print0 ) | ...
Chris Davies's user avatar
1 vote
1 answer
4k views

comm command behaving strangely

I have two files: one generated using find command in a folder to list files, sorting them numerically and writing to a file, and the other generated by a python script, which is not sorted, so I ...
user128785's user avatar
0 votes
1 answer
5k views

compare 2 csv files and output only difference into variable

1.csv: rundeck-read-only-iam-permissions,IAMReadOnlyAccess citrix-xendesktop-ec2-provisioning",AmazonEC2FullAccess 2.csv: citrix-xendesktop-ec2-provisioning",AmazonEC2FullAAA citrix-xendesktop-ec2-...
Milister's user avatar
  • 537
0 votes
1 answer
94 views

How to use comm to match log files with same elements, but different timestamps?

I'm trying to use the comm command to compare two logs to see which apps have been installed but not removed. I don't want to use awk for this, if possible. Here's and example of the files: Installed:...
rrfeva's user avatar
  • 73
49 votes
2 answers
112k views

Common lines between two files [duplicate]

I have the following code that I run on my Terminal. LC_ALL=C && grep -F -f genename2.txt hg38.hgnc.bed > hg38.hgnc.goi.bed This doesn't give me the common lines between the two files. ...
Marwah Soliman's user avatar
0 votes
2 answers
1k views

comm is not proving expected result

I have couple of files (file 1.txt and file2.txt) and I am using unix "comm" command to compare those files to find out unique lines on file1.txt Here are the lines having on file1.txt: OD1 EN2 OD3 ...
AmitDas's user avatar
2 votes
1 answer
916 views

Removing lines in LARGE text file containing string found in other LARGE text file - FILES SORTED

Still having issues trying to remove lines in a LARGE file containing strings listed in another LARGE file. grep -vwFf file1 file2 - FAILS due to memory exhaustion. I have used: comm -23 file1 ...
speld_rwong's user avatar
3 votes
1 answer
3k views

How can I use comm in this way?

From my understanding I want to use comm -23 file1 file2. file1 is the result of find and file2 is cut -c43- list. Is it possible I can write this as 1 line and not use any files (except the one I ...
user avatar
1 vote
1 answer
548 views

Why does the output of comm fail to show common records?

I have a list of IDs (sorted) in two files and I ran the comm command to compare them, but it seems to miss out one lines common to both files. Why is that? File1: 1 2 3 4 5 6 7 8 9 11 12 13 15 16 ...
PhD's user avatar
  • 165
3 votes
1 answer
142 views

Naive line-by-line comparison like "comm -3" but looking like "diff -y"

I am looking from something which gives me an output of comm -3 on two sorted outputs (line-by-line comparison, only additional/missing lines from either side) but which looks more like the output ...
phk's user avatar
  • 5,963
1 vote
2 answers
4k views

Can linux command comm handle UTF-8 encoded text files?

I want to compare two UTF-8 encoded text file. Can Linux command diff and comm handle these encoding?
user41451's user avatar
  • 113
1 vote
1 answer
315 views

Compare two files line by line without comm (I need to maintain order of file 1)

File 1: happy sad calm palm File 2: palm dream calm I want to compare the two files and display only those line that are common in both the files, but I want to maintain the order of File 2. My ...
user avatar
0 votes
2 answers
810 views

How to compare multiple files and display the common lines?

I have four files like so: File 1 contents (tab separated, 3 columns): applepen apple pen strawberry straw berry File 2 contents: applepen strawjelly File 3 contents(This file is sorted): apple ...
user avatar
2 votes
2 answers
3k views

compare 1 column in 2 files and print the different line

I have file1 and file2. file1: a james b mike d john file2: a 10 20 30 40 b 11 12 13 14 c 20 30 40 50 d 10 20 30 50 I want the output file to only find the difference in column 1, and print that ...
nico's user avatar
  • 31
3 votes
2 answers
1k views

Find IP addresses visiting /page1 but not /page2 from nginx access logfile

I need to select specific data's from log files. I need two scripts: I need to select all IP addresses that only visited /page1 I need to select all IP addresses that visited /page1 but never visited ...
Delirium's user avatar
  • 378
-1 votes
2 answers
733 views

collect and create tab separated matrix

I have 6 text files (each corresponds to a specific sample) and each file looks like this: Gene_ID Gene_Name Strand Start End Length Coverage FPKM TPM ENSMUSG00000102735 Gm7369 + ...
sbradbio's user avatar
0 votes
1 answer
261 views

Compare a certain lines from multiple documents

I want to compare a certain lines in a multiple documents. I tried using diff and comm, but the conditions are these, the documents are in a different working directory/folder, I could use a wildcard ...
marco guidolla's user avatar
5 votes
2 answers
153 views

Invert matching lines, NUL-separated

I’m writing something that deals with file matches, and I need an inversion operation. I have a list of files (e.g. from find . -type f -print0 | sort -z >lst), and a list of matches (e.g. from ...
mirabilos's user avatar
  • 1,733
0 votes
3 answers
3k views

Matching lines in two files [duplicate]

Let's say I have two files, file1 and file2. file1: passd:xxx hopla:alli gnar:gungg araf:utap file2: alli utap How can i check what lines/words from file2 match file? Indeed I could probably do ...
trolkura's user avatar
  • 407
3 votes
1 answer
375 views

Is comm output guaranteed sorted?

Is the output of comm guaranteed sorted? In my simple examples they are and that makes sense to me (how I think comm works); however, I need to comm very large files and worried that comm might do ...
Jeff's user avatar
  • 165
4 votes
2 answers
2k views

Comparing files in unix columnwise

I want to compare two files with same number of rows and columns with records in same order. Just want to highlight the differences in the column values if any. file A: 1,kolkata,19,ab 2,delhi,89,...
user2910372's user avatar
5 votes
2 answers
15k views

RFCOMM device seems to be missing (dev/rfcomm0)

I am trying to send and receive serial commands over bluetooth. I have installed pyBluez library. The issue is that while the rfcomm.conf exists there is no rfcomm0 in /dev/ directory. I rebooted but ...
DominicM's user avatar
  • 669
0 votes
2 answers
2k views

comm not working to find unique words to file1 from two files

I have two text files in which I have to use the comm command to extract all unique words from file 1. So just those that are not in file 2. I was asked to use the comm command (not diff nor join). I ...
hdb004's user avatar
  • 1
3 votes
2 answers
4k views

comm fails on bash variable input

I have a script that's supposed to get the list of files of two directories, get differences and execute some code for certain files. These are the commands to get the file lists: list_in=$(find ...
stefan's user avatar
  • 1,009
15 votes
2 answers
21k views

comm: file is not in sorted order

I used comm to compare two sorted files. Each line in these files are positive integer numbers. But the results show comm: file 1 is not in sorted order comm: file 2 is not in sorted order How come ...
wenzi's user avatar
  • 403