grep regex: search for any of a set of words -
i want search large set of files set of words in order, or without spaces or punctuation. so, example, if search hello, there, friend
, should match
hello there friend friend, hello there theretherefriendhello
but not
hello friend there there friend
i can't figure out way this. possible using grep, or variation of grep?
is possible using grep, or variation of grep?
you can use grep -p
ie in perl
mode,the following regex.
^(?=.*hello)(?=.*there)(?=.*friend).*$
see demo.
Comments
Post a Comment