3 ms·
When you have such a large awk script, you may as well also demonstrate that Awk is a “real scripting language” by putting it into its own script with a `#!/usr
by derefr 6y ago
When you have such a large awk script, you may as well also demonstrate that Awk is a “real scripting language” by putting it into its own script with a `#!/usr/bin/awk -f` shebang line. Much easier to edit than trying to get your shell to do it. (Unless you’re using a fancy editing shell like Emacs’ shell mode; but at that point, why would you need Awk? You probably know far better how to use your own shell-runtime’s text-manipulation primitives.)
- dredmorbius 6y agoSure. Though such scripts often begin as shell one-liners. This one did. Never left it, as it happens. C-x C-e FTFW. (I expanded, indented, and commented the example for HN.)