Gentoo Archives: gentoo-user

From: Alexander Kapshuk <alexander.kapshuk@×××××.com>
To: Gentoo mailing list <gentoo-user@l.g.o>
Subject: Re: [gentoo-user] search files for "text string"
Date: Sat, 06 Jun 2015 17:09:44
Message-Id: CAJ1xhMVuhMQ5oVM5uatBn2yZq-dAN78N7refNVyJJQ_Nk9M=EQ@mail.gmail.com
In Reply to: [gentoo-user] search files for "text string" by Joseph
1 On Sat, Jun 6, 2015 at 7:45 PM, Joseph <syscon780@×××××.com> wrote:
2
3 > I've bunch of php files in many directories and I need to file a text
4 > string in them "Check/Money Order"
5 >
6 > I've tried:
7 > find -type f -print0 | xargs -r0 grep -F 'Check/Money Order'
8 > it doesn't work.
9 >
10 > What is a better method of searching files?
11 > --
12 > Joseph
13 >
14 >
15 grep -ls 'Check/Money Order' `du -a | sed '/\.php$/!d;s/.*\t//'` # grep
16 will complain that the args list is too long if the number of files found
17 is too great.
18
19 Otherwise, this might work for you:
20
21 find dir -type f -name \*.php | xargs grep -sl 'Check/Money Order'

Replies

Subject Author
Re: [gentoo-user] search files for "text string" Joseph <syscon780@×××××.com>