coreutils
[Top][All Lists]
Advanced

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

Re: tsort: "odd input of tokens" with paired input


From: Alad Wenter
Subject: Re: tsort: "odd input of tokens" with paired input
Date: Wed, 6 Apr 2016 21:11:54 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1

On 06.04.2016 15:51, Assaf Gordon wrote:
Hello,

On Apr 6, 2016, at 06:45, Michael V. Antosha <address@hidden> wrote:
On 4/6/16, Alad Wenter <address@hidden> wrote:
Hello,

When trying to run tsort on a moderately large
paired list, I get:

tsort: -: input contains an odd number of
tokens
head -89 pre_tsort.txt | tsort  # success
# First 89 lines are okay.  Line 90 is bad.
<shameless plug>

The recent version of GNU Datamash ( http://gnu.org/s/datamash ) has a new 
operation 'check' to quickly diagnose cases like this (non-tabular file 
structure) and provide verbose report of the problem.

Example:

     $ curl -s https://ptpb.pw/c1Vu > test.txt
     $ datamash -W check < test.txt
     line 89 (2 fields):
      cower cower
     line 90 (3 fields):
      deluge-labelplus deluge gtk2
     datamash: check failed: line 90 has 3 fields (previous line had 2)


The '-W' parameter tells datamash to use whitespace as field-separator (default 
is tab).
</shameless plug>


regards,
  - assaf

Thanks for the ideas. There were indeed some lines with a third field (I didn't expect a dependency which had a whitespace in its name...).

Using grep also works:

 % grep '.* .* .*' pre_tsort.txt
deluge-labelplus deluge gtk2
deluge-movetools deluge gtk2
deluge-smartmove deluge gtk2
deluge-stats deluge gtk2
deluge-webapi deluge gtk2

"datamash -W check" is nice to automate this, though I agree on having line-numbered errors for tsort. :)

Cheers,

Alad




reply via email to

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