3 ms·
> Also, awk has a fun way of parsing input, which makes for very enjoyable one liners. Yes, being able to casually toss off an awk (or sed) one-liner is a very
by a3n 12y ago
> Also, awk has a fun way of parsing input, which makes for very enjoyable one liners.
Yes, being able to casually toss off an awk (or sed) one-liner is a very convenient skill to have.
- davidp 12y agoYep. Need line 123425938039 of a gigantic file? [0] sed -e 'NR == 123425938039 { print; exit; }' < file Fast as hell and takes no memory to speak of. Google 'awesome awk' for goodies. [0]: Yes, this happens.
- eadler 12y agoWouldn't it be slightly easier to do something like sed -n 123425938039p file? To be fair, this one won't exit early.
- busterarm 12y agoI agree, but I get most of the same out of Ruby even if might be slightly less readable (or ugly Ruby code). It's nice that the mentality comes out of using certain languages though. also http://tomayko.com/writings/awkward-ruby http://tomayko.com/writings/awkward-ruby
- kazinator 12y agoSo you get an ugly program that requires a third party tool, rather than just a POSIX system. I would say that this solution then requires additional justification compared to the Awk no-brainer.