Selective beginnings dating service
The lines from input stream are placed into the pattern space where they are modified. These four spaces changed the way I think about sed.
Awesome news: I have written an e-book based on this article series.
It appends a newline followed by the contents of hold buffer.
Inspired by the success of my "Awk One-Liners Explained" article (30,000 views in first three days), I decided to explain the sed one-liners as well.
These one-liners, just like the Awk one-liners, are compiled by Eric Pement. You can even write tetris in it (not to mention that it's Turing complete).
Check it out: This sed one-liner uses the 'G' command.
If you grabbed the cheat-sheet you'd see that the command 'G' appends to the pattern space.
I could not figure one of the one-liners in the file, so I ended up asking for help in shell.
In the second part I will cover "Selective printing of certain lines" and in the third "Selective deletion of certain lines" and "Special applications".Before I start explaining, I want to share the key idea that changed the way I think about sed.You may download them here: sed one-liners (link to file). My sed learning process was actually identical to Awk learning process.Most people are only familiar with one particular command of sed, namely the "s" (substitute) comand. First I went through Bruce Barnett's sed tutorial; then I created a sed cheat sheet; and finally went through sed one-liners.
It was the four spaces of sed -- input stream, output stream, pattern space, hold buffer.Sed operates on input stream and produces an output stream.