There are a lot of like lines in some files that we have here and I'm trying grep out some lines with certain criteria. The criteria I'm trying to grep for is the number 217848 and BIG. How do I grep for these both in the same command?
If you want to get all instances of lines that have "217848" and "BIG" in the files, you have to use
grep -E "217848|BIG" <filename or list of files>
or
egrep "217848|BIG" <filename or list of files>
Using grep "217848" <file or list of files> | grep BIG, or grep "217848" <file list> |grep BIG will only give you one return, even if there are many lines that have both "217848" and BIG in them.
If "217848" and "BIG" should be in the same line - then use:
grep "217848" <file list> |grep BIG
This gives the "AND" effect.
If "217848" and "BIG" should be in the differnt lines and you want to gerp for either one - then use:
grep -E "217848|BIG" <filename or list of files>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.