Re:Useful Perl one-liners (2013)
by swuecho on Tuesday November 29, 2016 @01:24PM
(#13064983)
for me, I do not know sed or awk.
[ Parent
| on HN ]
Perl's substitution and translation facilities work pretty much the same way as sed, if you understand sed you can just drop those operations into Perl. For example, sed -i 's/old/new/' will do an in-place replacement of all strings 'old' with the string 'new'.
I find that you do escaping a little differently with sed though. For example you need to escape +'s for them to have their normal "one or more matches" semantics. Might just be an abnormality of my environment (Cygwin).