10

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).

DVK
  • 321
  • Please note that due to the context for asking, all I need is a "yes/no" asnwer, with yes showing a single example to prove its validity. – DVK Jul 09 '13 at 22:14
  • Would Solaris qualify or are you only looking for Linux variants? – slm Jul 09 '13 at 22:17
  • 1
    The inclusion of awk is part of the POSIX standard. – jasonwryan Jul 09 '13 at 22:19
  • @slm - I'm old enough to remember time BEFORE Linux :) Solaris definitely qualifies, so does SunOS, HpUX and Dec Alpha. – DVK Jul 09 '13 at 22:19
  • 1
    I definitely agree with the "someone at SO" asserting every Unix has awk. The fact embedded systems that do not use awk remove it from their file system doesn't mean they are missing awk. They just choose not to include it to save space which is quite different. – jlliagre Jul 09 '13 at 22:44
  • @jlliagre - When your question is "can I solve this problem by running an awk command", the answer "no, since you have no awk available" means "no" independently of WHY the situation arose. – DVK Jul 09 '13 at 22:45
  • 1
    I do not question the fact some busybox based appliances miss awk, I just believe they no more deserve being called Unix because of this fact. – jlliagre Jul 09 '13 at 22:56

3 Answers3

18

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.

  • +1, especially for BusyBox. That fits perfectly with what I needed. Is awk included with BusyBox's Android APK? – DVK Jul 09 '13 at 22:24
  • It's included in that: https://code.google.com/p/yangapp/downloads/detail?name=busybox-1.20.2r2 – slm Jul 09 '13 at 22:27
  • @slm - Yay! That means Android has both Perl and Awk (the former via ASE). Now I can start programming on it :) – DVK Jul 09 '13 at 22:29
  • 2
    I disagree with this answer. An Operating System without awk is not a "stripped-down unix" because it is not a unix. BusyBox doesn't claim to be a Unix, because it isn't. The question was not "are there OS's without awk"; it was "are there unices without awk", and the answer must be "no" by definition. – rici Jul 09 '13 at 22:41
  • 2
    @rici Unix V1 through V6 are hardly “not a Unix”, though you could claim that they were Unix but are not. BusyBox does aim to be a package of Unix utilities — of course, if you don't install the full package, you don't get all the utilities, but BB is designed to accommodate partial installations. There's no fixed definition of Unix; it is perfectly reasonable to call an embedded device running a BusyBox installation without awk a “stripped-down unix”. – Gilles 'SO- stop being evil' Jul 09 '13 at 22:49
  • Minix 2 as well as Minix 1.2, being a version 7 clone, definitely included awk. http://www.raspberryginger.com/jbailey/minix/html/m_8c-source.html – jlliagre Jul 09 '13 at 23:25
  • @Gilles: unix is a registered tradmark belonging to the open group, whodo have a definition.. See http://www.unix.org/what_is_unix.html. – rici Jul 10 '13 at 00:31
  • 1
    @rici Yes, but not every unix is a Unix™. – Gilles 'SO- stop being evil' Jul 10 '13 at 00:41
4

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:

slm
  • 369,824
  • "implementation exists" != "is included in default distribution in a stripped down embedded version". Please see Gilles' answer for an example. – DVK Jul 09 '13 at 22:27
  • 1
    @DVK - see my comment on Gilles answer. AWK is included in Android APK's busybox. It is stripped down as you say. Seems like semantics a bit, a portion of it's functionality is included in busybox, is that by your definition "not included" b/c it's not a full implementation? – slm Jul 09 '13 at 22:28
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:

Wildcard
  • 36,499