Hacker News new | past | comments | ask | show | jobs | submit login

My little story about building a "real" program in awk was really just a toy example - I did it to teach myself some awk. I wouldn't really recommend writing significant persistent scripts in awk that much, if only because nobody else will want to maintain them. I think the beauty of awk for me is the little tiny bits of one liners that I can string together to do a quick bit of ad-hoc work. Anything more and I agree with you - I'd pick a real programming language.



"I think the beauty of awk for me is the little tiny bits of one liners that I can string together to do a quick bit of ad-hoc work. "

Again, my point is that you can do the same thing in Ruby, Python, Perl, or Lua just as easily and fast as you can in Awk. Awk used to have a nice niche years back. It pretty much lost that niche the second Perl got popular. It's even more irrevant now that Ruby and Python are even easier and faster to build stuff with quickly

About the only real pragmatic reason I can think of for learning Awk is to migrate existing Awk scripts, that started as nice useful one liners but eventually evolved into spaghetti, to Python / Ruby


I'm pretty sure he's talking about simple command line work. You seem to be missing the point. Compare:

  | awk '{print $2}' | ...

  | python -c 'import sys
  for line in sys.stdin:
    try:
      print line.split()[1]
    except IndexError:
      print' | ...


Yeah, but try

  | perl -nae 'print $F[1], "\n"'
  | ruby -nae 'puts $F[1]'
Your local python oil vendor may have a one liner for that language as well.


I still posit that awk '{print $1}' is simpler




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: