4 ms·
Even though it's more characters, I usually use perl -pe 's/search/replace/' instead of sed in pipelines because it understands /n (and other escape characters
by rflrob 9y ago
Even though it's more characters, I usually use perl -pe 's/search/replace/' instead of sed in pipelines because it understands /n (and other escape characters I don't remember). Because all it takes is to get burned a couple times for it to be worth sticking with what you know will work.
- _delirium 9y agoThe Perl version is considerably faster on large files as well. Or at least, it is when compared to the version of BSD sed shipped with OSX.
- kronos29296 9y agoThis is probably not the case with the sed in Linux.
- dozzie 9y ago"/n"? What's that? My `man perlre' doesn't say anything about this regexp flag.
- tribby 9y agobecause OP is referring to escape characters I assume it is a typo for "\n"
- jwilk 9y agoProbably not what rflrob meant, but /n prevents parentheses from capturing. https://perldoc.perl.org/perlre.html#%2an%2a https://perldoc.perl.org/perlre.html#%2an%2a
- dozzie 9y agoThis is somewhat surprising. A relatively new feature, and not present in my current Perl.