Are there versions of Unix that don’t have awk installed by default?
I am fine with an answer containing some really old outdated Unix variant which predates awk’s creation; but would ideally prefer some specialist niche stripped down embedded modern one which excludes awk by design from core install.
(the impetus for asking: someone claimed that an SO answer using nothing but standard unix command line tools sans awk is useless, since every Unix has awk. I am pretty sure that last part is wrong, but don’t recall any specific examples, just the fact that they exist).
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Awk is part of POSIX and Single Unix (and has been since they exist). It has also been a part of classical Unix for a very long time, and is installed by default on every modern full-fledged Unix.
Awk is a few years younger than Unix, so obviously there have been versions of Unix without Awk. Awk appeared in V7 and in BSD since the first full release. MINIX 2 had awk; I’m not sure if the few systems based on MINIX 1 all had it.
There are stripped-down unices today without Awk — mostly embedded systems running Linux with BusyBox. BusyBox does have an awk command, but it is optional, like almost everything in BusyBox.
As a sociological matter, if someone tells you that they have “a Unix system” or “a Linux system” (or variants thereof), you can safely assume that they have awk. You should only worry about the availability of awk if you’re told that they’re running an antique system or a stripped-down system.
Method 2
The AWK wikipedia page states it as follows:
excerpt
As one of the early tools to appear in Version 7 Unix, it gained
popularity as a way to add computational features to a Unix pipeline
and besides the Bourne shell is the only scripting language available
in a standard Unix environment. It is one of the mandatory utilities
of the Single UNIX Specification; required by the Linux Standard
Base specification — and implementations of AWK exist for almost
all other operating systems.
Given this I’d say there isn’t a version of UNIX that goes without including AWK.
Partial implementations?
Here’s where it can get in the gray area. Applications like Busybox include a subset of awk functions so it’s difficult to qualify whether it’s included or not.
See what’s included in Android APK for example:
Method 3
Solaris “small server” installations do not have a POSIX-compliant Awk available.
Technically this means they are not POSIX and not UNIX, but it’s certainly possible that you will want to have your script work on these systems.
For additional reading, see:
- https://unix.stackexchange.com/a/360380/135943
- https://www.mail-archive.com/[email protected]/msg00885.html
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0