Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: sed/awk/grep to Perl

by haukex (Archbishop)
on Nov 09, 2020 at 15:15 UTC ( [id://11123530]=note: print w/replies, xml ) Need Help??


in reply to sed/awk/grep to Perl

Inherited few Perl Script with echo/sed/awk/grep commands in backticks or system. Is it best practice to convert them to Perl or to leave as it is.

IMHO, yes, definitely! See Calling External Commands More Safely for the issues with backticks, and also The problem of "the" default shell, which also names a few equivalencies.

Do we have conversion recopies ?

Well, for sed and awk there are App::s2p and App::a2p, respectively, although note the Perl code they produce isn't perfect - but it's a good starting point for conversion. As for the others, grep shouldn't be all too difficult to convert to Perl regexes, and if there's anything else, then perhaps you can name them more specifically and show examples, and perhaps we can help with those.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (None)
    As of 2024-04-18 23:42 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found