-1

In linux, i have one file which having only file names inside( 60 file names only,no other contents),

file60.txt

  foo
  foo123
  ...
  bar

and another file with 63 file names, mostly the same, but 3 more.

file63.txt

  foo
  foo123
  ...
  hello
  bar
  world
  baz

How to compare the content of file60.txt with the content of file63.txt ?

2
  • 1
    Compare it in what way? Do you want the common lines? Those in file60 that aren't in file63? Those in file63 that aren't in file60? All of the above? And what should be "removed"? Please edit your question and show us your desired output.
    – terdon
    Dec 1, 2015 at 12:28
  • how about viewing them with gvimdiff or tkdiff?? Dec 1, 2015 at 17:08

1 Answer 1

1

if file are sorted

comm -13 file60.txt file63.txt

if file are unsorted

comm -13 <(sort file60.txt) <(sort file63.txt)

to remove

rm $(comm -13 <(sort file60.txt) <(sort file63.txt))

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .