Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Agree about portability issues. I cover only gawk, because I don't know all the differences between various versions. This started as a chapter in my command line text processing repo, where I cover various tools. I had come across various posts on stackoverflow/unix.stackexchange about implementation differences. I use Ubuntu, so I made a choice of sticking to GNU/Linux to make my life simpler.

I'm not sure about your point saying "only very minor enhancements". When I posted about my book on reddit, I got this comment [1] noting feature differences.

[1] https://www.reddit.com/r/commandline/comments/fqkc6r/just_pu...



The way to see if something works in AWK is to read the 2004 Open group POSIX standard on it:

https://pubs.opengroup.org/onlinepubs/009695399/utilities/aw...

Here’s my AWK (OK, shell + AWK) one liner:

  while echo -n '] ' ; do read a; awk 'BEGIN{print '"$a"'}' ; done
It’s a calculator; type in something like 2 + 2 and it will give you 4. Since standard AWK has advanced math functions like log, it’s a full blown scientific calculator.

The only tricky part is that you hit Ctrl + C (not Ctrl + D) to exit it.




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

Search: