I want to find the lines in which atleast one of the strings among string1 and string2 are present in the file.
grep 'string1' 'string2' file
;-this is an error even though!!
how could i do the above on unix command line?
I want to find the lines in which atleast one of the strings among string1 and string2 are present in the file.
grep 'string1' 'string2' file
;-this is an error even though!!
how could i do the above on unix command line?
If your version of grep supports the -E
flag (e.g. the GNU version), you can use extended regular expressions, which allows you to perform queries like this:
$ grep -E 'string1|string2'
or
$ grep -E 'string[12]'
See pcresyntax(3) and pcrepattern(3) for further information on PCRE (Perl Compatible Regular Expressions).