From: laredotornado on
Ok, I give up. How do you use sed to do a multiline search given a
regular expression? I don't want to replace anything, just do a
search, much like grep. However, I'm to understand that grep only
searches one line at a time.

Thanks, - Dave
From: pk on
laredotornado wrote:

> Ok, I give up. How do you use sed to do a multiline search given a
> regular expression? I don't want to replace anything, just do a
> search, much like grep. However, I'm to understand that grep only
> searches one line at a time.

http://sed.sourceforge.net/sedfaq4.html#s4.23

after reading that, you'll might think of switching to another tool.

From: laredotornado on
On Dec 13, 12:35 pm, pk <p...(a)pk.invalid> wrote:
> laredotornado wrote:
> > Ok, I give up.  How do you use sed to do a multiline search given a
> > regular expression?  I don't want to replace anything, just do a
> > search, much like grep.  However, I'm to understand that grep only
> > searches one line at a time.
>
> http://sed.sourceforge.net/sedfaq4.html#s4.23
>
> after reading that, you'll might think of switching to another tool.

Do you have a suggestion, or even an example, or something else that
can match multi-lines given a regular expression? - Dave
From: Ed Morton on
laredotornado wrote:
> On Dec 13, 12:35 pm, pk <p...(a)pk.invalid> wrote:
>> laredotornado wrote:
>>> Ok, I give up. How do you use sed to do a multiline search given a
>>> regular expression? I don't want to replace anything, just do a
>>> search, much like grep. However, I'm to understand that grep only
>>> searches one line at a time.
>> http://sed.sourceforge.net/sedfaq4.html#s4.23
>>
>> after reading that, you'll might think of switching to another tool.
>
> Do you have a suggestion, or even an example, or something else that
> can match multi-lines given a regular expression? - Dave

awk. Post some small but realistic sample input, what you want to match on, and
the expected output.

Ed.
From: Ben Bacarisse on
laredotornado <laredotornado(a)zipmail.com> writes:

> On Dec 13, 12:35 pm, pk <p...(a)pk.invalid> wrote:
>> laredotornado wrote:
>> > Ok, I give up.  How do you use sed to do a multiline search given a
>> > regular expression?  I don't want to replace anything, just do a
>> > search, much like grep.  However, I'm to understand that grep only
>> > searches one line at a time.
>>
>> http://sed.sourceforge.net/sedfaq4.html#s4.23
>>
>> after reading that, you'll might think of switching to another tool.
>
> Do you have a suggestion, or even an example, or something else that
> can match multi-lines given a regular expression? - Dave

I'd use Perl. The real reason to use Perl is that it has excellent
HTML/XHTML parsing modules ready to use. Other threads suggest that
HTML is the reason you are asking. If you think you can get by with a
text match rather than a real parse then other text tools can be used.

Another route worth considering is an XSLT processing tool.

--
Ben.
 |  Next  |  Last
Pages: 1 2
Prev: Use of 'set'
Next: The select builtin and white space