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

It'll work with more than gawk (e.g. mawk as well) but yeah, it will not work with busybox awk. In the context of an interactive shell command I doubt many people care much about posix; indeed I struggle to recall any context in which I ever cared about posix compliance as such. Unless you have an personal or professional interest in fringe operating systems posix compliance is mostly of interest as an imperfect proxy for answering the question will it work on both Linux, macOS/iOS (and maybe busybox).

Anyway, I suspect the following is POSIX compliant:

    git status -s | awk 'gsub(/^ M /,"")' | tr \\0 \\n | ...



> Unless you have an personal or professional interest in fringe operating systems posix compliance

I mostly hit things like these with alpine containers and openwrt. OpenWRT I guess could be considered "fringe operating system", but alpine (at least for containers) seems reasonably mainstream?


Ugh, should of course have been

    git status -s | awk 'gsub(/^ D /,"")' | tr \\n \\0 | ...




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: