Re: tab as sort's field-separator
Paul Eggert <[email protected]>
| Newsgroups | gmane.comp.gnu.textutils.bugs |
|---|---|
| Message-ID | <[email protected]> |
> Date: Mon, 17 Jun 2002 23:15:09 -0600 > From: [email protected] (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.