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:
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.txtfind out common lines in them
comm -3 file?.sorted.txt
Comments
Post a Comment