1

I found a post that answers how to merge sort and remove duplicates. I'm interested in expanding on this and extracting new unique entries from the post-merged file. What would be the command to do so? I.e. merge small.txt into large.txt, but also create a new.txt where new.txt contains new values that did not previously exist in large.txt?

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
outofstock
  • 11
  • 1

1 Answers1

1

How is it different then runnig the same commands again

   # original lists
   cat small.txt large.txt | sort | uniq > uniq.txt

   # unique list + new list
   cat new.txt uniq.txt | sort | uniq > new_uniq.txt

PS.

also you can short write sort | uniq as sort -u

Rabin
  • 3,818
  • 1
  • 21
  • 23