diff - Csh how to compare the content of two files in different sequence? -


need in comparing contents of 2 files (in different sequence , spacing) , output difference in csh. tried diff -w file1 file2, somehow doesn't work.

file1

cat white 123 dog brown 234 duck black 567 rat grey  345 fish blue 456 

file2

fish               blue    456 rat                grey    345 dog                brown   234 

output

cat white 123 duck black 567 

thanks in advance.

you solve problem 2 steps:

  1. squeeze spaces , sort lines

    perl -w -ne 's/\s+/ /g; say' file1.txt | sort > file1.sorted.txt perl -w -ne 's/\s+/ /g; say' file2.txt | sort > file2.sorted.txt 
  2. find out common lines in them

    comm -3 file?.sorted.txt 

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -