Questions tagged [comm]
For questions pertaining to comm, a utility to select or reject lines common to two files.
49
questions
46
votes
2
answers
106k
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. ...
15
votes
2
answers
20k
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 ...
8
votes
3
answers
28k
views
Issues of using sort and comm
I was trying to find the intersection of two plain data files, and found from a previous post that it can be done through
comm -12 <(sort test1.list) < (sort test2.list)
It seems to me that ...
5
votes
2
answers
14k
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 ...
4
votes
3
answers
12k
views
Find common elements in a given column from two files and output the column values from each file
I have two files with tab-separated values that look like this:
file1:
A 1
B 3
C 1
D 4
file2:
E 1
B 3
C 2
A 9
I would like to find rows between files 1 and 2 where the ...
4
votes
2
answers
142
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 ...
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,...
3
votes
1
answer
140
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 ...
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 ...
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 ...
3
votes
2
answers
92
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
...
2
votes
1
answer
3k
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 /...
2
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 ...
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 ...
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 ...
2
votes
1
answer
361
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 ...
2
votes
1
answer
773
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 ...
2
votes
5
answers
912
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<=...
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 ...
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 ...
1
vote
1
answer
493
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
...
1
vote
1
answer
304
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 ...
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?
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 ...
1
vote
1
answer
1k
views
Diff similar lines
I'd like to print a list of lines where the first word in two files is identical, and the rest of the words are not. Some complicated mess with comm, grep and cut would be possible, but hopefully ...
1
vote
3
answers
721
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 ...
1
vote
2
answers
30
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") | ...
1
vote
1
answer
318
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 ) | ...
1
vote
3
answers
376
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 ...
1
vote
0
answers
80
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.
...
0
votes
2
answers
221
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 ...
0
votes
1
answer
83
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 ...
0
votes
1
answer
1k
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 ...
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 ...
0
votes
2
answers
110
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 ...
0
votes
1
answer
169
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.
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
...
0
votes
1
answer
52
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
...
0
votes
1
answer
4k
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-...
0
votes
1
answer
92
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:...
0
votes
2
answers
771
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
...
0
votes
1
answer
256
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 ...
0
votes
1
answer
149
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 ...
0
votes
4
answers
272
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 ...
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 ...
-1
votes
4
answers
77
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/...
-1
votes
1
answer
138
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....
-1
votes
2
answers
725
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 + ...
-3
votes
2
answers
195
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 ...