I just a have a small problem with comparing two files with the diff command in a shell script. Say I have two ascii files, file1.txt and file2.txt, with contents:
file1.txt
blah/blah2/content.fits/
blah3/blah4/content2.fits/
blah5/blah6/content3.fits/
blah7/blah8/content4.fits/
file2.txt
content.fits
content2.fits
I would now like to make a comparison of the two files based on the .fits extensions but write out the output to an ascii file keeping the formatting in file1.txt, i.e in this particular example the output file after comparing these two should give:
blah5/blah6/content3.fits/
blah7/blah8/content4.fits/
any ideas?
You can use this awk to get that output: