Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Awk > Re: matching n'...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 8 of 13 Topic 2216 of 2236
Post > Topic >>

Re: matching n'th pattern...

by tomekl <tomek@[EMAIL PROTECTED] > Apr 6, 2008 at 10:50 AM

On 6 Kwi, 19:46, tomekl <to...@[EMAIL PROTECTED]
> wrote:
> On 6 Kwi, 19:51, pk <p...@[EMAIL PROTECTED]
> wrote:
>
>
>
> > tomekl wrote:
> > >> FS = "<[^>]*>"
>
> > > This one is close, but it gives me matches for each html pattern, I
> > > didnt manage to write FS for particular html pattern (ex <li>...</
> > > li>), but as I wrote before, I want to match only text between those
> > > tags...
>
> > If you don't provide more precise examples, it's difficult to help.
This
> > works with the input you showed, but might not be what you want:
>
> > FS='foo<li>|</li><li>|</li>bar'
>
> > but it's too obvious to be what you're looking for. Also, it assigns
a, b
> > and c to $2, $3 and $4 respectively (not $1, $2 and $3), but this
should
> > not be a big problem.
>
> > --
> > All the commands are tested with bash and GNU tools, so they may use
> > nonstandard features. I try to mention when something is nonstandard
(if
> > I'm aware of that), but I may miss something. Corrections are welcome.
>
> For FS="<[^>]*>" it assings $2=a $4=b $6=c, to be more precise, I need
> this regular expression to match only for particular pair of tags, for
> example for <li> and </li>, so for the string:
>
> '<html>foo<li>A<br></li><li><b>B</b></li><li>C</li>bar</html>For
FS="<[^>]*>" it assings $2=a $4=b $6=c, to be more precise, I need
this regular expression to match only for particular pair of tags, for
example for <li> and </li>, so for the string:

'<html>foo<li>A<br></li><li><b>B</b></li><li>C</li>bar</html>'

I would like to have assigned to variable only A, B, and C strings...
'
>
> I would like to have assigned to variable only A, B, and C strings...

Ah I made mistake in previous example, the output for
'<html>foo<li>A<br></li><li><b>B</b></li><li>C</li>bar</html>' and
<li> and </li> tags should be:

$1 = A<br>
$2 = <b>B</b>
$3 = C




 13 Posts in Topic:
matching n'th pattern...
tomekl <tomek@[EMAIL P  2008-04-06 08:56:07 
Re: matching n'th pattern...
gazelle@[EMAIL PROTECTED]  2008-04-06 16:17:02 
Re: matching n'th pattern...
tomekl <tomek@[EMAIL P  2008-04-06 09:23:23 
Re: matching n'th pattern...
pk <pk@[EMAIL PROTECTE  2008-04-06 19:51:48 
Re: matching n'th pattern...
pk <pk@[EMAIL PROTECTE  2008-04-06 19:56:43 
Re: matching n'th pattern...
tomekl <tomek@[EMAIL P  2008-04-06 09:25:13 
Re: matching n'th pattern...
tomekl <tomek@[EMAIL P  2008-04-06 10:46:07 
Re: matching n'th pattern...
tomekl <tomek@[EMAIL P  2008-04-06 10:50:01 
Re: matching n'th pattern...
pk <pk@[EMAIL PROTECTE  2008-04-06 20:21:09 
Re: matching n'th pattern...
pk <pk@[EMAIL PROTECTE  2008-04-06 20:46:42 
Re: matching n'th pattern...
tom <tomasz.lutelmowsk  2008-04-06 11:49:09 
Re: matching n'th pattern...
Ed Morton <morton@[EMA  2008-04-06 14:06:02 
Re: matching n'th pattern...
Peter Jasper <usenet77  2008-04-08 02:43:47 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri May 16 10:10:25 CDT 2008.