17:12 >perl -wE "my $s = q{/fold1/fold2/fold3/file.pl}; print $1, qq{\n} if $s =~ m{^(.+?)[^/]+$}; /fold1/fold2/fold3/ 17:16 >