grep: compare two unsorted files and get unique lines

Konstantinos Patronas
LinuxStories
Published in
1 min readOct 6, 2020

--

Scenario: every day we run a report that produce a csv file with some IDs and we want to check the differences that those two files might have, we need to check if there are missing IDs from the previous day CSV vs the current day CSV and vice versa.

The contents of the previous day file: previous.txt

AAA1
BBB1
CCC1
DDD1

The contents of the current day file: current.txt

AAA1
BBB1
DDD1
EEE1
  1. To find if there is an ID in the previous day…

--

--

Konstantinos Patronas
LinuxStories

DevOps engineer, loves Linux, Python, cats and Rock music