4 ms·
I almost exclusively use perl -pi -e COMMAND instead of sed for stream processing. I also use grep --perl-regexp in most cases. I need to remember Emacs and
by jedbrown 15y ago
I almost exclusively use
perl -pi -e COMMAND
instead of sed for stream processing. I also use grep --perl-regexp in most cases. I need to remember Emacs and perl regex semantics; I'd rather not have more variants to remember.
- perlit 15y agoAnd just like sed -i, perl -i supports adding a backup extension. Also you can get awk-like perl by using -a, for example: perl -nale 'print $F[1]' # note fields start at 0 unless you change $[ You can also make grep, but it's a bit long perl -ne 'print if /foo/'