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 ... works fine given a tab


From: Jim Fohlin
Subject: Re: tab as sort's field-separator ... works fine given a tab
Date: Wed, 19 Jun 2002 04:18:50 -0400
User-agent: Mutt/1.2.5i

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




reply via email to

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