Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Equivalent of Linux Grep Command

by thunders (Priest)
on Jul 13, 2009 at 19:42 UTC ( [id://779732]=note: print w/replies, xml ) Need Help??


in reply to Equivalent of Linux Grep Command

That's a reasonable start to an implementation. Any solution I can think of involve scanning the file and maintaining @before and @after buffers as you go.

Perl isn't really intended to provide one liners for every common unix command, and grep itself is a tool not a programming language, any implementation of grep in C is considerably more than one 80 character line of code.

There is a program called prep on CPAN, which is a pure perl implementation of grep. The source to that program may provide inspiration.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://779732]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2026-02-14 10:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.