wiki.hjertnes.website

Perl as sed

Something I discovered while reading thosands of pages trying to find a good setup for doing search and replace with regular expressions on the command line

perl -p -i -e 's/Barfoo/Foobar/g' *txt

The long story is that I want to do search and replace on the command line, and sed is mostly what I want. Except that I want modern regular expressions and sed only use the arcane unix stuff. AWK isn't really my kind of thing. It's kind of awkward. Then I found the snippet above. It is mostly what I wanted. Something that works more or less like sed, with modern regexp support. I'd much prefer it if someone made a modern sed with a perl compatible regular expression engine. But it works