re: About grep

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>Date: Sun, 11 Jan 2004 19:38:15 -0800 (PST)
>From: Jack Wang <jwus2001@xxxxxxxxx>
>To: redhat-list@xxxxxxxxxx
>Content-Type: text/plain; charset=us-ascii
>List-Id: General Red Hat Linux discussion list <redhat-list.redhat.com>
>Subject: About grep
>
>I can use the following grep command to find a string
>in current directory:
>
>grep "abc" *.*
>
>How to find a string recursively into subdirectories?

My personal favorite is still:

find . -type f -exec grep 'abc' {} /dev/null \;

Note the use of /dev/null as a second file name arg to grep:
this forces grep to emit the name of the file the search string was found in, if any...without it you get a list of the matched lines, but no file name where found...useless.


Now if only "find" had "grep" built in... :)

-- johnT
John McKowen Taylor, Jr.
Cadence Design Systems, Inc.
200 Regency Forest Dr.
Cary, NC 27511 USA
+1 919 481 6835


-- redhat-list mailing list unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux