[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: awk
- To: Leonid Leibman <http://www.raqia.com/~leonidl>
- Subject: Re: awk
- From: http://dummy.us.eu.org/robert (robert)
- Date: Thu, 29 Nov 2001 15:59:04 -0500
- In-Reply-To: <3C068D86.1080900@raqia.com>
- Keywords: http://www.raqia.com/~leonidl
> From: Leonid Leibman <http://www.raqia.com/~leonidl>
> Date: Thu, 29 Nov 2001 14:33:26 -0500
>
> Hi, Robert -- do you know whether there is a way to make gawk understand \n?
> Suppose I have a file which contains lines separated by \n (newline) and
> I want to match
> certain patterns regardless whether they are more than one line long.
> For example
> I have a file containing 2 lines of aa-s:
>
> aa
> aa
>
> and I want to match a pattern '/aa\012aa/ {print $1}'
>
> Is there a way to do this????
You probably cannot put the newline right in the pattern itself. Probably
you'll have to do something like:
/aa/{if (lastaa) { print "success"; } lastaa=1; }
/aa/! { lastaa=0; }
I have no idea whether this would work. I'd just write it in Perl :-).