Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: lsuser epoch translate

by sn1987a (Deacon)
on Aug 15, 2014 at 17:54 UTC ( [id://1097598]=note: print w/replies, xml ) Need Help??


in reply to lsuser epoch translate

The key difference between your code and atcroft's code above is the quotes. With the double quotes in your example, the shell will replace the $1 before perl gets to see it. Using the single quotes will protect the variable names.
$ echo "19284732 Test message 123456789012345" | perl -pe "s/(\d{8,})/ +scalar localtime $1/e;" Fri Aug 15 12:52:29 2014 Test message 123456789012345 $ echo "19284732 Test message 123456789012345" | perl -pe 's/(\d{8,})/ +scalar localtime $1/e;' Tue Aug 11 23:52:12 1970 Test message 123456789012345

Replies are listed 'Best First'.
Re^2: lsuser epoch translate
by dcronin135 (Acolyte) on Oct 06, 2014 at 01:46 UTC

    You are absolutely right! Don't know how I missed such a simple syntax.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (1)
As of 2024-04-25 01:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found