create new tag
, view all tags
Some ways of searching all files (for a given string).

Considering renaming this file, to include a Cli (Command LIne) prefix, and then maybe: CliSearchMultipleFilesForAString.




Looks like it can be done with grep:

grep -r -e new4 -H -f /etc/sysconfig/*

  • -H -- lists the name of the file
  • -e -- the search pattern follows -e
  • -f -- get the patterns from a file (?? -- that doesn't seem to be what happens above)
  • -R or -r -- recursive

Using pattern new4 search all files in /etc/sysconfig and show me the filename next to any matches/images/whitepixel.gif -- from http://www1.jpartner.com/public/documentation/platform/linux/grep.htm

One caution: be careful searching /* -- you will end up searching /dev and /proc, and at least one of those seems to get you lost in a quagmire.


Not sure it can be done with for, or not as easily as grep

(starting with stuff from http://www.cglug.org/presentations/scripting.html)

This looks like a start, but AFAIK, it only does one directory:

for file in *; do cat $file; done | grep -H at2000 | less

I can, successively modify the * to */*, then */*/*, I guess, or maybe find a way to put that in a loop, possibly with the backticks or something.

Here's a potentially useful trick, especially with -R or -d options for ls:

for filename in `ls` ...


  • () RandyKramer - 18 Mar 2003
  • <If you edit this page: add your name here; move this to the next line; and include your comment marker (initials), if you have created one, in parenthesis before your WikiName.>

Page Ratings

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2003-04-01 - RandyKramer
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by PerlCopyright 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding WikiLearn? WebBottomBar">Send feedback
See TWiki's New Look