Questions tagged [comm]

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

Select or reject lines common to two files

External reference

comm specification (The Open Group Base Specifications Issue 7, 2018 edition)

49 questions
45
votes
2 answers

Common lines between two files

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. What am I missing there?
Marwah Soliman
  • 643
  • 3
  • 7
  • 10
15
votes
2 answers

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 the error even if these two files are sorted?
wenzi
  • 403
  • 2
  • 6
  • 9
8
votes
3 answers

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 sort test1.list aims to sort test1.list in order. In order…
user288609
  • 641
  • 3
  • 8
  • 16
5
votes
2 answers

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 no change. If I run the following I get…
DominicM
  • 659
  • 2
  • 15
  • 26
4
votes
3 answers

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 string in column 1 is the same, then get the…
turtle
  • 2,607
  • 5
  • 19
  • 16
4
votes
2 answers

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 grep -z foo lst >matches – note that this is only an…
mirabilos
  • 1,723
  • 15
  • 33
4
votes
2 answers

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,cd 3,bangalore,56,ef file…
user2910372
  • 141
  • 2
3
votes
2 answers

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 DESCRIPTION Compare sorted files FILE1…
Julia
  • 31
  • 1
3
votes
2 answers

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 input/ -maxdepth 1 - type f | sed 's/input\///' | sort…
stefan
  • 1,009
  • 2
  • 13
  • 18
3
votes
1 answer

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 from diff -y, e.g. in that it uses the whole…
phk
  • 5,893
  • 7
  • 41
  • 70
3
votes
2 answers

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 /page2 I have my desired logs in a .tar file. I…
Delirium
  • 368
  • 1
  • 5
  • 22
2
votes
5 answers

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<=10000;i++)) do comm -12 --nocheck-order a.txt "$i".txt…
2
votes
1 answer

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 /tmp/all) aa bb cc hello xyz.txt I have…
Girish
  • 123
  • 1
  • 5
2
votes
4 answers

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 unfortunately fails for me. what am i doing…
JammingThebBits
  • 426
  • 4
  • 13
2
votes
1 answer

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
  • 799
  • 1
  • 12
  • 21
1
2 3 4