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

java - How to Configure JAXRS and Spring With Annotations -

visual studio - TFS will not accept changes I've made to a Java project -

php - Create image in codeigniter on the fly -