in reply to Re^6: Most efficient way to remove some text from a string
in thread Most efficient way to remove some text from a string
XML ? something like this perhaps. Open the output file with a browser to get text folding.
#!perl use strict; use XML::Simple; #my $infile = '/home/zzz/Desktop/Scripting/usb/musicLibrary.txt'; #open IN,'<',$infile or die "Could not open $infile $!"; #while (<IN>){ my %hash=(); while (<DATA>){ chomp; if (/\.m4a$/){ my @f = split '/',$_; push @{ $hash{'artist'}{$f[-3]}{'album'}{$f[-2]}{'track'}},$f[-1]; } } open OUT,'>','report.xml' or die "$!"; print OUT XMLout(\%hash,RootName=>'records'); __DATA__ /Volumes/WD/Not Migrating/Music/Ana Tijoux /Volumes/WD/Not Migrating/Music/Ana Tijoux/Luchin /Volumes/WD/Not Migrating/Music/Ana Tijoux/Luchin/Luchin.m4a /Volumes/WD/Not Migrating/Music/Ana Tijoux/Kaos/ /Volumes/WD/Not Migrating/Music/Ana Tijoux/Kaos/Intro.m4a /Volumes/WD/Not Migrating/Music/Ana Tijoux/Kaos/Gol.m4a /Volumes/WD/Not Migrating/Music/Ana Tijoux/Kaos/Track3.m4a /Volumes/WD/Not Migrating/Music/Ana Tijoux/Kaos/Track4.m4a
Be aware of the STATUS of XML::Simple and the CAVEATS within
poj
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: Most efficient way to remove some text from a string
by adamZ88 (Beadle) on Dec 09, 2016 at 22:04 UTC |