Gentoo Archives: gentoo-user

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

Replies

Subject Author
Re: [gentoo-user] search files for "text string" Alexander Kapshuk <alexander.kapshuk@×××××.com>