Your skill will accomplish what the force of many cannot |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
hope this helps:
perl -i -pe 'if (/<level1 id=\"(.*)\">/) {$currentid = $1;} elsif (/<level2>/) {s/<level2>/<level2 id="$currentid">/g}' input edit: just deleting the redundant $_. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "one who asks a question is a fool for five minutes; one who does not ask a question remains a fool forever." mk at rio dot pm dot org In reply to Re: Regex problem while parsing tagged, hierarchical data
by mk.
|
|