Linux Grep the delta -


i have 2 files: file1, file2. want lines file2 don't exist in file1.

i have read post told me use -v flag of grep it(i read man page of grep still did not quite how use -f , -x flag), have no luck far.

$ cat file1 eric cartman kenny mccormick  $ cat file2 stan marsh kyle broflovski eric cartman kenny  mccormick  $ grep -v file1 file2 stan marsh kyle broflovski eric cartman kenny  mccormick 

my expected output should this:

stan marsh kyle broflovski 

this grep line may help:

 grep -fvf file1 file2 

or awk:

 awk 'nr==fnr{a[$0]=1;next}!a[$0]' file1 file2 

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -