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:49:33
Message-Id: CAJ1xhMU2mgXLX_ctzS2kaFG_UR9R-y7FraP7Ue7Vh0fw4rJr4A@mail.gmail.com
In Reply to: Re: [gentoo-user] search files for "text string" by Joseph
1 On Sat, Jun 6, 2015 at 8:46 PM, Joseph <syscon780@×××××.com> wrote:
2
3 > On 06/06/15 20:09, Alexander Kapshuk wrote:
4 >
5 > On Sat, Jun 6, 2015 at 7:45 PM, Joseph <[1]syscon780@×××××.com> wrote:
6 >>
7 >> I've bunch of php files in many directories and I need to file a
8 >> text string in them "Check/Money Order"
9 >> I've tried:
10 >> find -type f -print0 | xargs -r0 grep -F 'Check/Money Order'
11 >> it doesn't work.
12 >> What is a better method of searching files?
13 >> --
14 >> Joseph
15 >>
16 >> grep -ls 'Check/Money Order' `du -a | sed '/\.php$/!d;s/.*\t//'` # grep
17 >> will complain that the args list is too long if the number of files
18 >> found is too great.
19 >> Otherwise, this might work for you:
20 >> find dir -type f -name \*.php | xargs grep -sl 'Check/Money Order'
21 >>
22 >
23 > Thanks, this worked for me, it searches in current and below dir.
24 >
25 >
26 >
27 Good to hear.