Prev: Use of 'set'
Next: The select builtin and white space
From: laredotornado on 13 Dec 2009 14:36 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 13 Dec 2009 14:35 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 13 Dec 2009 15:40 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 13 Dec 2009 15:47 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 13 Dec 2009 22:23
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. |