Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

by Discipulus (Canon)
on Feb 02, 2021 at 11:35 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-19 02:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found