Wijaya Edward wrote: > Hi all, Hello,
> I have a snippet that rename files from: > "sth.txt.out" into > "sth.out" > > Now I am really curious how can I make this > oneliner "even shorter": mmv '*.txt.out' '#1.out' > $ perl -e ' > for(glob ("*.txt.out")){ for ( <*.txt.out> ) { > $out = $_; > $out =~ s/\.txt(\.out)/\.out/; Your pattern is not anchored so 'a.txt.out-bcd.txt.out' will be changed to 'a.out-bcd.txt.out'. ( $out = $_ ) =~ s/\.txt\.out\z/.out/; Or: ( $out = $_ ) =~ s/\.txt(?=\.out\z)//; Or: ( $out = $_ ) =~ s/\.txt(\.out)\z/$1/; > rename ($_,$out); > }' John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>