Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: How to repeat a string multiple times if found match

by BillKSmith (Monsignor)
on Mar 10, 2021 at 03:54 UTC ( #11129389=note: print w/replies, xml ) Need Help??


in reply to How to repeat a string multiple times if found match

This one-liner even creates a back-up in case things go wrong!
>perl -pibak -e"$_ = qq(foo_1\nfoo_2\nfoo_3\nfoo_4\n) if /^foo_$/" xx. +txt >dir xx.txt* Volume in drive C is Windows Volume Serial Number is AE03-D45F Directory of C:\Users\Bill\forums\monks 03/09/2021 10:47 PM 57 xx.txt 03/09/2021 07:04 PM 35 xx.txtbak 2 File(s) 92 bytes 0 Dir(s) 379,932,401,664 bytes free >type xx.txt hello world foo_1 foo_2 foo_3 foo_4 foo abc
Bill

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2022-05-19 21:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (72 votes). Check out past polls.

    Notices?