bug-textutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tab as sort's field-separator


From: Paul Eggert
Subject: Re: tab as sort's field-separator
Date: Mon, 17 Jun 2002 23:39:38 -0700 (PDT)

> Date: Mon, 17 Jun 2002 23:15:09 -0600
> From: address@hidden (Bob Proulx)
> 
>    tab=$(printf "\t")
>    sort -t"$tab" -u -k2,2 -k1,1
> 
> This appears to be POSIX standard.

It is POSIX standard and it is fairly safe nowadays, but it won't work
on older hosts.  I believe the "printf" command was first standardized
by XPG4 (dated 1992), and many older hosts do not have it.  In
contrast, the solution with Awk should work all the way back to Unix
Version 7 (dated 1978).  But if you're using $(...) instead of `...`
then I guess you're not worried about older hosts anyway....

On Solaris 9 "printf" is part of the SUNWloc package, and this package
is occasionally not installed on some bare-bones Solaris hosts; e.g. see
<http://groups.google.com/groups?selm=38F5B805.E1026EBC%40ks.sel.alcatel.de>.
In contrast, "awk" is in SUNWesu, which is almost always installed.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]