Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^4: replace string from Command Line (updated)

by AnomalousMonk (Archbishop)
on Oct 13, 2020 at 20:03 UTC ( [id://11122793]=note: print w/replies, xml ) Need Help??


in reply to Re^3: replace string from Command Line (updated)
in thread replace string from Command Line

What is your data?

Win8 Strawberry 5.8.9.5 (32) Tue 10/13/2020 15:55:21 C:\@Work\Perl\monks\pragovnj >cat junque.txt foo bar CAST(CAST(hs_date AS DATE FORMAT 'YYYYMMDD') AS CHAR(08)) as h +s_date biz boz C:\@Work\Perl\monks\pragovnj >perl -p -i.bak -e "s/\QCAST(CAST(hs_date AS DATE FORMAT 'YYYYMMDD') A +S CHAR(08)) as hs_date\E/FORMAT_DATE(hs_date, 'YYYYMMDD') as hs_date/ +g;" junque.txt C:\@Work\Perl\monks\pragovnj >cat junque.txt foo bar FORMAT_DATE(hs_date, 'YYYYMMDD') as hs_date biz boz C:\@Work\Perl\monks\pragovnj >cat junque.txt.bak foo bar CAST(CAST(hs_date AS DATE FORMAT 'YYYYMMDD') AS CHAR(08)) as h +s_date biz boz
(Sorry for any wrap-around. :) In general, "it doesn't work" is a very poor problem description.

Update: Please see Short, Self-Contained, Correct Example for a discussion of good problem presentation practices.


Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-25 21:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found