On 06.04.2016 15:51, Assaf Gordon wrote:
Hello,
On Apr 6, 2016, at 06:45, Michael V. Antosha <[email protected]> wrote:
On 4/6/16, Alad Wenter <[email protected]> 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