in reply to A poor bloke and his regex...
use strict; use warnings; while (<DATA>) { chomp; my ($dir, $crap) = split ' ', $_, 2; printf "%s\n", $dir eq 'INVALID' ? $dir.' '.$crap : $crap; } __DATA__ /base-dir/dir/foo.txt INVALID ORDER-NO 4546090 /base-dir/dir/foo.txt INVALID ORDER-NO 4546090 INVALID ORDER-NO 4546090 INVALID ORDER-NO 4546090
|
|---|