1

I am trying to use a simulated "and" statement with egrep. Currently I have egrep -i 'name.*policy' which works only if the order of appearance is true. Alternatively, I can egrep -i 'name.*policy|policy.*name' . I want to see if there is a better way to use an "and statement that is not order specific.

Steve
  • 133
  • 2
    There isn't, use your solution or grep name | grep policy – ctx Mar 21 '17 at 17:34
  • Sorry yes it is duplicated for the most part. I was hoping to see if there was an improved way to use " egrep -i 'name.*policy' " that would not be order specific. Clearly there is not. – Steve Mar 21 '17 at 18:10

1 Answers1

1
grep -P '(?=.*policy)(?=.*name)'