News for hackers. Stuff that matters.
Re:Useful sed scripts and patterns by superasn on Friday November 12, 2021 @06:14AM (#29198133)
Which is why I've always stuck to `perl -pi -e`.

It may not be as powerful but it's just one thing to learn. Also it understands regexs like '\d', etc which are kinda universal but for some reason don't work with many of these utils.

Re:Useful sed scripts and patterns by kbenson on Friday November 12, 2021 @12:09PM (#29201728)
I wouldn't call having the de-facto standard for an advanced regular expression system, a full programming language and the entirety of the CPAN module system easily pulled in and used less powerful.

I use sed for a lot of simple stuff, but I use Perl all the time for more advanced stuff. Perl is great for grabbing complex chunks out of a line and doing something with them that requires a bit of state. For example, writing a quick and dirty logfile parser to figure out how many requests and how many bytes were used by each IP over a time period (the time period limiting usually being a prior grep before being passed to Perl). I've probably taken 60 seconds to write out something to parse exactly what I want from a log hundreds of times.

Re:Useful sed scripts and patterns by gnubison on Friday November 12, 2021 @11:55AM (#29201509)
Perl is certainly more powerful than sed or awk :)
Re:Useful sed scripts and patterns by mdaniel on Friday November 12, 2021 @11:52AM (#29201465)
I also read once that perl was the most ubiquitous tool across all Unixen flavors, but I don't have a link to cite for it