4 ms·
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
by AceJohnny2 5y ago
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'.
- lhoursquentin 5y agohttps://www.grymoire.com/Unix/Sed.html 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 :)
- JNRowe 5y agoUnlike 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 https://www.gnu.org/software/sed/manual/html_node/index.html
- AceJohnny2 5y agoAwesome! They are indeed much clearer than the FreeBSD manpage I have on macOS.