2
votes
4answers
259 views

Zgrep stop after first match when arguments are passed from xargs

I'm using this command to find patterns in zip files (similar to the one) suggested here http://superuser.com/questions/144926/unix-grep-for-a-string-within-all-gzip-files-in-all-subdirectories find ...
1
vote
3answers
2k views

Linux: Does find | xargs grep have limitations?

I've historically performed something like: find . 2>/dev/null | xargs grep -i something_to_find 2>/dev/null If my pwd is barfoo (/foo/bar/baz/foofoo/foobar/foobaz/barfoo) it finds matches. ...
4
votes
3answers
267 views

Use command grep and locate

How I can make the grep command locate certain words in the files specified by the routes found by the locate command? locate my.cnf | grep user (I want that grep command search the word "user" ...
3
votes
3answers
4k views

How can I pass strings with single quotes to grep?

My desired outcome is the following: to recursively search a directory looking for a given string in all found files. The following command is my usual port of call: find ./ | xargs grep -ns 'foobar' ...
3
votes
2answers
9k views

using xargs to grep multiple patterns

I have a file that has terms I want to grep for, with each term being one line in the file. I was thinking I could do this with xargs. What I'm able to glean from examples from the man page like this ...
2
votes
2answers
371 views

xargs grep suggestion

grep -v "\<Swap" instruments.log | awk '{ idx=index($0, "MasterId="); masterId=substr($0, idx+length("MasterId=")+1); masterId=substr(masterId,1,index(masterId,"L")-3); print masterId; }' | xargs ...
3
votes
6answers
1k views

Grep a directory and return list with line numbers

I'm currently trying to learn more about bash scripting and all of that fun stuff, and I pieced together this little command: find $path | xargs grep -n $pattern | awk '{print $1}' While this DOES ...
6
votes
6answers
8k views

How to search for a word in entire content of a directory in linux

need to search for something in entire content I am trying: find . | xargs grep word I get error: xargs: unterminated quote How to achieve this?
10
votes
3answers
2k views

bash find xargs grep only single occurence

Maybe it's a bit strange - and maybe there are other tools to do this but, well.. I am using the following classic bash command to find all files which contain some string: find . -type f | xargs ...