[Top][All Lists]

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

sort does not use tab as delimiter

From: DI Oliver Maurhart
Subject: sort does not use tab as delimiter
Date: Sat, 09 Dec 2006 12:44:52 +0100
User-agent: Thunderbird (X11/20061127)

Hi *,

I'm refering to coreutils-6.4.

Based on a discussion on the german gentoo-forum
(http://www.gentooforum.de/thread.php?threadid=11947&hilight=sort), I've
noticed that sort doesn't use the tab as delimiter when provided by the
'-t' option.

As I then examined the code, sort actually takes the literal 't' as
delimiter when passed this line:

$ sort -t \t -k 2 FILE

When doing things like this:

$ sort -t "\t" -k 2 FILE

Sort complains about a multi-character string.

Therefore, when I patched at line 2553:
$ diff src/sort.c src/sort.c.org
<         char newtab = optarg[0];
>           char newtab = optarg[0];
<         else
<         if (STREQ (optarg, "\\t"))
<             newtab = '\t';

sort *really* uses tab as the sort delimiter.

I think it would be nice to add this tab-capabilities to the sort
command, or are there any objections against using it?

kind Regards,

Oliver Maurhart

PS: Full working snippet starting at Line 2543:
        case 't':
        char newtab = optarg[0];
            if (! newtab)
              error (SORT_FAILURE, 0, _("empty tab"));
            if (optarg[1])
                if (STREQ (optarg, "\\0"))
                  newtab = '\0';
        if (STREQ (optarg, "\\t"))
            newtab = '\t';
                    /* Provoke with `sort -txx'.  Complain about
                       "multi-character tab" instead of "multibyte tab", so
                       that the diagnostic's wording does not need to be
                       changed once multibyte characters are supported.  */
                    error (SORT_FAILURE, 0, _("multi-character tab %s"),
                           quote (optarg));
            if (tab != TAB_DEFAULT && tab != newtab)
              error (SORT_FAILURE, 0, _("incompatible tabs"));
            tab = newtab;

 * This is my signature
 * @return      all may account data (if you need it)
CAddress CEMailSignature::getMyAddress() const {

   QString sTitle      = "Dipl.Ing.";
   QString sName       = "Oliver Maurhart";
   QString sProfession = "Software Development";

   QString sStreet     = "Duernfeld 3";
   QString sCity       = "9064 Pischeldorf";
   QString sState      = "AUSTRIA";

   // Telefon as hex: 0x3EAB83D3B45
   // But as dec seems more convenient, doesn't it?
   QString sTelefon    = "+43 / (0)664 / 825 12 05";

   // should return: "address@hidden"
   QString sEMail      = getCurrentMail().getFrom();

   // Chat?
   try {
   catch (IM::IamOfflineException& cException) {
      fprintf(stdout, "Sorry, but %s\n", cException.getReason());

   // normaly I use a single line here ...
   return CAddress(sName,

Attachment: oliver.maurhart.vcf
Description: Vcard

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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