On 10/19/05, Ranga Nathan <[EMAIL PROTECTED]> wrote:
> I need to check ftp logs  (see below) for successful transfer of files.
> This is a bash script someone else wrote and I need to modify it. I want
> to use a Perl style regex like
>
> /^125.*?baxp\.caed.*?\n250/i
>
>  in any ?grep or sed or awk whichever can do this.
>
> I tried grep and egrep - they seem to match only one line at a time. I am
> unable to match for \n inside the pattern.

They only match one line at a time.  That is what they do.

> What shell utility would do it? I dont want to bring in the perl
> interpreter just for this!
> Thanks for the help.

I would use Perl.  But you can try this:

  grep -A 2 -i '^125.*baxp\.caed' FILE_HERE | grep -B 2 '^250'

It will separate matches with lines containing --.

Though if you want to do anything interesting with them, it would be
easier to do it in Perl.  Because EVERY tool in the basic Unix toolset
assumes that "lines of data" are the data of interest, so data that
goes across a line boundary is a PITA to handle.

Cheers,
Ben
 
_______________________________________________
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to