News for hackers. Stuff that matters.
Re:Practical Shell Patterns I Use by AceJohnny2 on Monday January 10, 2022 @06:16PM (#29884453)
Can anyone recommend a modern explanation of sed's more advanced features?

I'm ashamed that, despite having learned many other ostensibly more complex systems and languages, sed continues to elude me. Of course I get the usual 's/foo/bar/g' stuff with regular expressions and placeholders, but I still don't really understand most of the other commands or, more usefully, the addresses.

Perhaps I need to spend quality time with the manpage in a cabin in the woods, away from modern distractions, but so far it has proven impermeable.

Perhaps I'm missing a proper understanding of its 'pattern space' vs 'hold space'.

Re:Practical Shell Patterns I Use by JNRowe on Monday January 10, 2022 @07:21PM (#29885232)
Unlike the GNU sed manpage, the info docs are really quite thorough and contain many examples. They cover the vast majority of the features, and they call out GNU specific extensions so they're useful for learning non-GNU sed too.

They're available in HTML too¹, if you don't like the info user experience.

¹ https://www.gnu.org/software/sed/manual/html_node/index.html

Re:Practical Shell Patterns I Use by AceJohnny2 on Tuesday January 11, 2022 @06:33PM (#29900029)
Awesome! They are indeed much clearer than the FreeBSD manpage I have on macOS.
Re:Practical Shell Patterns I Use by lhoursquentin on Monday January 10, 2022 @07:16PM (#29885180)
https://www.grymoire.com/Unix/Sed.html is a good resource to get started, though it's definitely something you should not just read due to the fact that sed code is pretty hard to read. Have a terminal on the side and try it out live. Once you understand pattern and hold spaces sed becomes a pretty fun esoteric language :)