News for hackers. Stuff that matters.
Re:Bringing the Unix philosophy to the 21st century (2019) by JJMcJ on Sunday August 22, 2021 @04:01PM (#28269022)
> awk

Or Perl. That's what Perl was originally created for.

Or sed. If awk is too mainstream for you.

Or Python.

Or just write the ugly pipeline in your script, and promptly forget how it actually works. I've done that a lot.

Re:Bringing the Unix philosophy to the 21st century (2019) by u801e on Sunday August 22, 2021 @04:32PM (#28269317)
> Or sed

After learning how to use ed in scripts, I've found it's actually easier to use it compared to sed because it effectively has random access through the input rather than going from beginning to end.

But both awk and Perl have the advantage of storing values in variables over sed or ed.

Re:Bringing the Unix philosophy to the 21st century (2019) by Koshkin on Sunday August 22, 2021 @06:27PM (#28270305)
sed, being a stream editor, is more efficient than ed, in that it does not need to keep the entire file in memory.
Re:Bringing the Unix philosophy to the 21st century (2019) by u801e on Sunday August 22, 2021 @08:58PM (#28271251)
True, but if the file isn't that big, then the difference isn't noticable.

Being able to do something like

  /some string/-2 d
Which deletes a line 2 lines above where some string matched is something that's trivial to do in ed, but takes a bit of work in sed.