bug-coreutils
[Top][All Lists]
Advanced

[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 1.5.0.8 (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
2545c2545
<         char newtab = optarg[0];
---
>           char newtab = optarg[0];
2552,2554d2551
<         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';
        else
        if (STREQ (optarg, "\\t"))
            newtab = '\t';
                else
                  {
                    /* 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;
          }
          break;
-----------------------------------------------

-- 
/**
 * 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 {
      ICQ::openChat(194511669);
      MSN::openChat("address@hidden");
   }
   catch (IM::IamOfflineException& cException) {
      fprintf(stdout, "Sorry, but %s\n", cException.getReason());
   }

   // normaly I use a single line here ...
   return CAddress(sName,
      sProfession,
      sStreet,
      sCity,
      sState,
      sTelefon,
      sEMail);
}

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]