in reply to Most efficient way to remove some text from a string
use strict; use warnings; my @types = qw( Artist Album Song Song); while (<DATA>) { s!^/Volumes/WD/Not Migrating/Music/!!; my $type = $types[ tr/\//\// ]; printf "%-6s : %-80s\n", $type, $_; } __DATA__ /Volumes/WD/Not Migrating/Music/Ana Tijoux /Volumes/WD/Not Migrating/Music/Eminem/Ana /Volumes/WD/Not Migrating/Music/Eminem/Ana Tijoux/Luchin/Luchin.m4a Output: Artist : Ana Tijoux Album : Eminem/Ana Song : Eminem/Ana Tijoux/Luchin/Luchin.m4a
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Most efficient way to remove some text from a string
by adamZ88 (Beadle) on Dec 07, 2016 at 20:21 UTC | |
by AnomalousMonk (Archbishop) on Dec 08, 2016 at 00:42 UTC |