If you have ever been interested in awk and sed Unix utilities, then you probably know about the awk1line.txt and sed1line.txt files that are floating around the Internet. Each file contains around 80 idiomatic sed and awk one-liners for performing various text modification tasks.
Making my way through them was not easy and I decided to write two articles explaining every one-liner in these files. It took me several months to finish them, but now I am proud that I did it.
Here is the Awk One-Liners Explained article: Part One, Part Two, Part Three, Part Four (bonus).
And here is the Sed One-Liners Explained article: Part One, Part Two, Part Three.
My future plans are to publish a free ebook with all the one-liners. If you are interested, please visit my site after a few months. I’ll publish it there.
My dad is always singing the praises of Sed and Awk but that’s not the only reason I don’t like them
They encourage these one-liners, which just means removing the formatting from code. They use regular expressions, something I consider should be avoided at all costs on account of their impenetrable syntax. My general feeling is that in the time it takes to figure out how to do anything with these tools, you could have just written a Python script to do it.
I’m sure they were great tools in their day but I really think Python trumps them, replacing all their functionality and throwing in maintainability to boot.
All that said, these are excellent, useful and well written articles. If I ever find I’m forced to use these things, I shall be eternally greatful that something like this exists.