Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Parse grep result

by loris (Hermit)
on Jan 30, 2008 at 11:33 UTC ( #665103=note: print w/replies, xml ) Need Help??


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)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://665103]
help
Chatterbox?
[Corion]: Meh. I need to find myself a better "programming" feed than r/programming (which is just HackerNews reposts and advertisements, very little code). Maybe I should select a list of links that I liked on r/programming and then google for ...
[Corion]: ... an aggregator site that also listed (ideally) all of these links once. And maybe also have an exclude list to blacklist some of the most spammy links that the site may have never mentioned at all
[marto]: I gave up reading HN at all, and feel much better for it :P
[Corion]: Now, how to best automate that Google search ... :-)
[Corion]: marto: Yeah, I'm also short of not reading it at all. I already stopped reading it in the morning because it gave me a foul mood.
[Corion]: The good posts on HN are the non-computing posts. Most of the other stuff is maybe relevant to you if you are 20 and live in Silicon Valley...
[Corion]: Two attributes that don't describe me.
[Corion]: Maybe I should also write a curator for HN or simply not read it anymore, like you do.

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2017-07-24 13:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (354 votes). Check out past polls.