Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Renaming all files in a directory -- perl -n -p and empty files oneliner

by Discipulus (Abbot)
on Feb 02, 2021 at 11:35 UTC ( #11127809=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    >perl  -nlE "say sprintf qq(caption%03s.txt),$count++" one.txt two.txt
    + three.txt
    
    ...
    caption001.txt
    caption002.txt
    
  2. or download this
    >perl -nlE "say sprintf q(caption%03s.txt),$1 if $ARGV =~ /.*([\d]+).*
    +/" one01.txt one02.txt
    
    caption001.txt
    caption002.txt
    
  3. or download this
    ls -l
    
    ...
    
  4. or download this
     perl -MTie::Scalar -M"5;{package SN; use parent -norequire => 'Tie::S
    +tdScalar';sub FETCH {print qq(Opening ${$_[0]}); ${$_[0]}}}; tie $ARG
    +V, SN" 
          -nlE "say qq(\tprocessed $ARGV) if eof" 001.txt 002.txt 003.txt
    ...
            processed 002.txt
    Opening 003.txt
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11127809]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2022-12-06 00:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?