Score:-1

how to use grep -f and -v together

jp flag

I have 2 files and I extracted information from file 2 based on file 1 by using grep -f file1 file2. Now if I want to use the output file to check if the columns based on file 1 are not there how can I do this efficiently. Grep -f -v do not work together. I tried the comm -12 file1 file2 command but it does not work. Need some guidance on grep -F -x -v -f file1 file2

Kindly help.

waltinator avatar
it flag
Read `man grep`.
Score:1
mx flag

Your command works as expected:

$ cat file1
b
c
$ cat file2
a
b
c
d
$ grep -Fxvf file1 file2
a
d
jp flag
Thanks for the guidance. I was wondering if I could have as output only those fields from file2 which are present in file1, the rest ignored. Kindly help.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.