5 ms·
Announcing my first e-book "Awk One-Liners Explained"
- unwind 15y agoI'm sure this is an awesome resource, and I really should check it out since I want to learn more of awk. That said, I find the initial "appetizer" example a bit contrived. To print all users from /etc/password from the command-line would probably not be done by writing a C program, by most (sane) people. I would just do "cut -d: -f1 /etc/passwd", which feels simpler than the awk example.
- forkrulassail 15y agoThat would be an interesting site idea in itself. CommandLineAlternative.to Shows several ways to accomplish the same thing with those closest to the minimum amount of characters and intended command line tool.
- sciurus 15y agohttp://www.commandlinefu.com/ http://www.commandlinefu.com/ does something close to this.
- pkrumins 15y agoAlso check out the "CommandLineFu One-Liners Explained" article series of mine: http://www.catonmat.net/blog/top-ten-one-liners-from-commandlinefu-explained/ http://www.catonmat.net/blog/top-ten-one-liners-from-command...
- hugh3 15y agoTo print all users from /etc/password from the command-line would probably not be done by writing a C program, by most (sane) people. I used to work with a guy who would have done it that way. I do admit he was not entirely sane. Personally I'd do it with two or three lines of python rather than awk, even though I theoretically know awk, because it's quicker for me to type the Python than to remember the syntax for the awk (wait, which brackets are which again?). That's not an argument against learning awk, of course, that's an argument for why I should learn awk slightly better.
- kisielk 15y agoYou sound like an exact match of the audience of this book.
- pkrumins 15y agoTrue, true. I am updating the page right now with a more appetizing example. With C example I just wanted to illustrate how long the C program would be compared to Awk, and that it makes sense to learn a scripting language. Yeah, the `cut -d: -f1 /etc/passwd` works.
- forkrulassail 15y agoinserts coin
- pkrumins 15y agoinsert coins, get pdf ebooks.
- jgeralnik 15y agoReally? The reason I should learn awk is "why not?" That has to be one of the worst reasons ever. Not that I am bashing awk or anything. I'm sure there are many reasons to learn it. But why not is definitely not one of them.
- burke 15y ago> bashing awk I know this was an unintentional pun, but I still thought it was funny.
- pkrumins 15y agoThat was my reason, cause I love to learn everything. Why not learn everything? :) I'll update the page with a more compelling reason. Thanks for bringing this up.
- lanstein 15y agoI had the same question the other day, and it turned into a spontaneous all-company "why you should use awk" lesson. If this kind of thing sounds cool to you, drop me a resume at david at loggly.com. We're at 1st and Mission in SF. Short answer, it's a baby programming language that's more powerful than sed, quicker to write than python, and less confusing than cut.
- andrus 15y agoI've found that awk is one of those tools whose potential use becomes clear only after putting in some initial effort to learn it. Along with sed, sort, and others, awk has solved problems for me that would have otherwise been extremely tedious. So the reason "why not be a master the shell" seems more about saving yourself time/being more efficient/knowing the tools at your disposal.
- pasbesoin 15y agopkrumins, out of curiosity (and the suspicion that you probably have ;-), have you written up you ebook publishing process?
- pkrumins 15y agoI have not yet written about it, but I will do that in a bit! The whole process was very interesting!
- spatten 15y agoI'd love to hear about it too. From a slightly selfish perspective, I'd love to know if you knew about Leanpub (http://leanpub.com http://leanpub.com) and, if you did, what about it made you do the work of publishing it yourself rather than going through us. I only ask because you really fit our target author profile perfectly, and we obviously screwed something up if you knew about Leanpub and still decided to build the workflow and sales site yourself :). If you didn't know about Leanpub, then obviously we need to market better.
- zoowar 15y agoSave your money or donate it to the FSF http://www.gnu.org/software/gawk/manual/ http://www.gnu.org/software/gawk/manual/ https://my.fsf.org/donate/ https://my.fsf.org/donate/
- SoftwareMaven 15y agoManuals are good once you already know something or if you want to become an expert. I don't think either of these are the buyer of the one-liner book. The one-liner buyer is a person who has the occasional need to script and doesn't want to have to become an expert again every time they need to do something. I learned enough awk once-upon-a-time that I think the book could be very useful. I tend to do python three-liners like somebody else here mentioned, but if I had a very quick way to find the awk, I'd use it more. The problem I have is that I'm not sure an ebook makes it fast enough.
- pkrumins 15y agoWhy's that?
- freejoe76 15y agoI suddenly have a desire to write a companion piece based on my experiences talking with women I just met: "Awkward one-liners explained."