Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: reparse tree in textfile

by myuserid7 (Scribe)
on Feb 20, 2010 at 23:33 UTC ( [id://824443]=note: print w/replies, xml ) Need Help??


in reply to reparse tree in textfile

Thanks for your efforts ikegami (Apostle) and repellent (Chaplain)

Awesome!!

worked on 70,000 line backup text file

I used

my @path = '.';

while (<STDIN>) {

chomp;

my ($prefix, $node) = /^((?:\| )*`-- )(.+)/

or next;

$#path = length($prefix)/2 - 1;

$path-1 = $node;

# print $prefix, join("/" => @path), "\n";

print join("/" => @path), "\n";

}

ikegami yes, I didn't want prefix printed

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://824443]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-19 04:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found