in reply to Parse grep result

It is not entirely clear to me what your problem is. If you are trying find arbitrary files within the file system, then you could just call

find / -name "*<search term>*

in your program (the find|xargs grep idiom is usually used when your grep does not have an option for recursion, as may well be the case on Solaris). This however will take a while if you have a large file system. If you have the locate command, use this - it will be much quicker.

BTW, if you do want to parse paths, use File::Basename.

loris


"It took Loris ten minutes to eat a satsuma . . . twenty minutes to get from one end of his branch to the other . . . and an hour to scratch his bottom. But Slow Loris didn't care. He had a secret . . ." (from "Slow Loris" by Alexis Deacon)

Replies are listed 'Best First'.
Re^2: Parse grep result
by vsailas (Beadle) on Jan 30, 2008 at 12:20 UTC
    Sorry for being brief...
    I was looking to list contents(files) of my folders including subdirectories which have the search term in them.
    Another query will File::Basename. more quick than 'find | xargs grep, ?

      File::Basename is just for parsing paths, not for searching for files in the file system.

      loris


      "It took Loris ten minutes to eat a satsuma . . . twenty minutes to get from one end of his branch to the other . . . and an hour to scratch his bottom. But Slow Loris didn't care. He had a secret . . ." (from "Slow Loris" by Alexis Deacon)