>>>>> "Robert" == Robert Leibl <[EMAIL PROTECTED]> writes:
Robert> Dermot wrote:
>> Hi,
>>
>> ls | perl -ne 'print if /\.$/'| sed 's/\(.*\)/mv & \1jpg/' | sh
>>
>>
>> I concocted the above command to change files named
>>
>> A1234. to A1234.jpg
>>
>> Is there a pure perl one-liner for this? Just curious.
>>
>> Thanx,
>> Dp.
>>
Robert> perl -e 'rename $_, $_."jpg" foreach (glob "*.")'
Why the extra parens? Also, I write foreach as for, whether it's
a for loop (like this isn't) or foreach loop (like this is).
perl -e 'rename $_, "${_}jpg" for glob "*."'
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/