-1

I have checked this topic to find two words in a text file: How to combine two search words with "grep" (AND)

But now I'm trying to know if it's possible to check when they are consecutive in the file. For instance:

grep -ilZ "not" file.txt | xargs -0 grep -il "sure"

In file.txt I have "I am not sure".

How could I do?

Thank you so much.

Community
  • 1
  • 1
jk_rg
  • 33
  • 6
  • 2
    Please add sample input and your desired output for that sample input to your question. – Cyrus Sep 14 '15 at 20:09

1 Answers1

0

Just grep -il "not sure" file.txt would solve your problem.

luoluo
  • 5,353
  • 3
  • 30
  • 41
  • I don't know what the hell happened before but now it worked, really thank you so much. – jk_rg Sep 15 '15 at 14:06