[Top][All Lists]

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

Re: sorting tables with headers

From: Bob Proulx
Subject: Re: sorting tables with headers
Date: Wed, 7 Apr 2004 22:45:50 -0600
User-agent: Mutt/1.3.28i

Thorvaldur Gunnlaugsson wrote:
> It is not a bug but would be a valuable improovment.
> People like to store data in tables with headers
> but when it comes to sorting, the headers are in the way.
> sort  --header=2 should just pass the first two lines right on.
>  --skip-header=2 ignore the first two lines.

It seems like there are easier ways to do that.

> Linux just needs to be a little bit nicer so people are
> not driven into excel with all their data.

Oh, goodness forbid that people be driven to that low level!  And
there is no need even with the present standard tools.  To skip the
first two lines, sort and keep the header on the following works.
The numbers 2 and 3 assume a two line header.

  cat <(head -n 2 datafile) <(tail -n +3 datafile | sort)

> I have my scripts in perl that transpose and
> tabulate data (better than the matrix command)
> also a join where there can be headers on one or both
> input files and join on more than one field
> but my understanding is that there is not interest in
> code written in perl.

The respository for Perl code is on www.cpan.org.  Besides, a small
system needs some type of core utilities.  But perl is quite large and
hard to justify in the essential set that every system must have
installed.  It is just too big and changes too often.


reply via email to

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