shell - Diff command for two files and output to third -


i have small problem comparing 2 files diff command in shell script. have 2 ascii files, file1.txt , file2.txt, 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 make comparison of 2 files based on .fits extensions write out output ascii file keeping formatting in file1.txt, i.e in particular example output file after comparing these 2 should give:

blah5/blah6/content3.fits/   blah7/blah8/content4.fits/   

any ideas?

you can use awk output:

awk -f/ 'fnr==nr {a[$1];next} !($(nf-1) in a)' file2.txt file1.txt blah5/blah6/content3.fits/ blah7/blah8/content4.fits/ 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -