Thanks, John! Nice one...

And then on the more primitive however also very useful end of the scale, there is locate (the package name varies a bit between distros), which builds a database of filenames (usually via cron), so that it can very quickly find files, provided some useful filename pattern is known. This is a lot faster than find on large filesystems, however at the expense of the flexibility that find offers.

Kind regards,

Helmut.

--
+------------------------+
| Helmut Walle           |
| [email protected] |
| +64-3-388 39 54        |
+------------------------+

On Mon, 16 Apr 2012, John Carter wrote:

I have long produced extraordinarily productive and useful one liners using the old "find 
-blah -blah | xargs grep blah sort of pipeline.... (Say "info finding files" if you
don't know this trick.)


Now I have a new weapon in my arsenal! 

The limitation of grep is that it only finds lines matching, searching across 
multiple lines and searches involving nested regions are just not doable with 
grep....

But sgrep can

eg.
  All {..} blocks not referring to fred
  sgrep '("{".."}" not containing "fred")' filename.c

 All C style comments with my name.
  sgrep '("/*".."*/") containing "Carter"' *.c

sgrep is available from Ubuntu synaptic or from...


http://www.cs.helsinki.fi/u/jjaakkol/sgrep.html
[...]
_______________________________________________
Linux-users mailing list
[email protected]
http://lists.canterbury.ac.nz/mailman/listinfo/linux-users

Reply via email to