cmd - Grep for windows -


old.txt contains

apple orange banana 

and new.txt contains

apple orange banana grape lemon 

i can access new contents added new.txt using grep command.

grep -fxvf old.txt new.txt > difference.txt  

now, difference.txt contains

grape lemon 

in windows, have tried

findstr /rvc:old.txt new.txt > difference.txt  

to find difference append contents of old.txt too. how can write equivalent command in windows?

you can use dos findstr following flags:-

/v   : prints lines not contain match. /g: file   : gets search strings specified file. 

the command like:-

c:\users\dude\desktop>findstr /v /g:old.txt new.txt >difference.txt 

now checking file output using type command; equivalent cat in linux, see :-

c:\users\dude\desktop>type difference.txt grape lemon 

Comments