File search using regex
Chris Organ
chrisorgan at adam.com.au
Thu Apr 19 11:01:43 CST 2007
On Thu Apr 19 0:03 , Mark Newton sent:
>Chris Organ wrote:
>
>> Wondering if someone can assist with regex searches using perl / grep / anything command line. I have lost a severe amount of hair looking for a multi-line search based on exact pattern matching. What I need to do is find this exact header within files within a directory and list them, similar output to using grep -l ie a list.
>
>All you wordy python programmers are weenies. What ever happened to
>efficient code, I ask you? Sheesh!
>
> - mark
>
>
>
>#!/usr/bin/perl
>
># usage: search.pl filespec
># (filespec can be a list of files, wildcard, etc...)
>
>local $/;
>
>map {
> open FH, "
> print "$_\n" if grep (/^!D2\nInvoice\n!C\nAUSTALIA EIGHT/, );
> close FH;
>} @ARGV;
>
># end
>
>
>
>--------------------------------------------------------------------
>I tried an internal modem, newton at atdot.dotat.org
> but it hurt when I walked. Mark Newton
>----- Voice: +61-4-1620-2223 ------------- Fax: +61-8-82356937 -----
Not enough arguments for grep at search.pl line 10, near ", )"
Execution of search.pl aborted due to compilation errors.
Help!
---- Message sent via Adam Internet WebMail - http://www.adam.com.au/
More information about the linuxsa
mailing list