Re: tab as sort's field-separator ... works fine given a tab
Jim Fohlin <[email protected]>
| Newsgroups | gmane.comp.gnu.textutils.bugs |
|---|---|
| Message-ID | <[email protected]> |
Andrew, Bob & Paul,
Like I've been trying to tell you guys :-), I'm convinced the tab
problem wrt to sort is a shell problem. Thanks for your patience and
helpful replies.
So in bash, the following works although it's not POSIX standard:
$ sort $'-t\t' -u -k2,2 -k1,1 /tmp/x
None of the echo, printf or awk solutions work with tcsh, so I'm still
where I started. But that's not your problem.
Any interest in including the tab capability in sort as in this code
that I did for fun?
#include <unistd.h>
int main (int argc, char **argv)
{
int i;
char *pgm = "/bin/sort";
for (i=0; i<argc; i++) {
if (strcmp (argv[i], "-t\\t") == 0)
argv[i] = "-t\t";
// printf ("<%s>\n", argv[i]);
}
execv (pgm, argv);
perror(pgm);
}
Jim