# ls -l
-rw-r--r--   1 root other  0 Mar 19 16:24 this is the first file
-rw-r--r--   1 root other  0 Mar 19 16:24 this is the second file
-rw-r--r--   1 root other  0 Mar 19 16:24 this is the third file

I want to rename the files, to say, first, second, etc

# ls -1 | perl -ne 'print $1,"\n" if /(\w+)\s+file$/'
first
second
third

now try use rename
# ls -1 | perl -ne 'rename $_ ,  $1  if /(\w+)\s+file$/'

won't work, like nothing happed?  why?

Thanks in advance.

ciwei


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to