in reply to Search thru directories of .c & .h files for @Constants

Not a Perl solution, but if you just want a quick result:
$ find . -name '*.[ch]' | xargs egrep -w 'foo|bar|baz|boz'

Dave.

Replies are listed 'Best First'.
Re^2: Search thru directories of .c & .h files for @Constants
by pmonk4ever (Friar) on Sep 19, 2007 at 01:06 UTC
    Ok, removed the h, and now it works...hmmm...well I can write a 2 line script, one for the *.c's and one for the *.h's !!!

    So it worked, with a tweak or 2...i like it because it's simple...but I still want to 'Perlize' it...

    Just for the experience!

    Thanks for your advice and help!

    ki6jux

Re^2: Search thru directories of .c & .h files for @Constants
by pmonk4ever (Friar) on Sep 19, 2007 at 00:52 UTC
    The -w option was unknown, so I removed that.

    Then it ran without finding the file, test_code.c in the current directory. So I looked up the commands, to better understand what we were doing...it should work, but it just returns empty...no printout at all.

    ki6jux

    my rep now stands @ -3...

      egrep --recursive --include=*.[ch] 'foo|bar|baz|boz' *

      But you need an advanced grep, such as gnu grep.

      A word spoken in Mind will reach its own level, in the objective world, by its own weight