help-recutils
[Top][All Lists]
Advanced

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

Re: [help-recutils] Looking For Recsort


From: Jose E. Marchesi
Subject: Re: [help-recutils] Looking For Recsort
Date: Mon, 31 Oct 2011 18:41:01 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (gnu/linux)

Hi.

    In the online documentation I don't see a recutils tool to sort
    entries in the database. Is there one? Or are there options for
    "recsel" or some other way to output the records in a specific
    order?

recutils 1.3 does not support any sorting facility.  But recutils 1.4
(which will be released this Wednesday) does.  The pre-release 1.3.90 at
http://alpha.gnu.org/gnu/recutils includes that support.

So you can wait until 1.4 is out, get the development version from git
or install the 1.3.90 pre-release.

In a nutshell, with recutils >= 1.3.90 you can use the %sort special
field to determine the desired sorting criteria for a record set.  For
example, having the following database:

   %rec: Item
   %key: Id
   %sort: CheckInDate

   Id: 10
   CheckInDate: 20 November 2011

   Id: 20
   CheckInDate: 15 November 2011

Operations with recsel, recfmt or any other recutils extracting
information from the recfile will honour %sort and display the entries
in the order given by CheckInDate:

   $ recsel -t Item
   Id: 20
   CheckInDate: 15 November 2011

   Id: 10
   CheckInDate: 20 November 2011

Alternatively, you can use the new -S|--sort command line argument in
recsel and in recfmt to specify another field to be used as the sorting
criteria.  If you use this option then %sort will be ignored.  For
example:

   $ recsel -t Item -S Id
   Id: 10
   CheckInDate: 20 November 2011

   Id: 20
   CheckInDate: 15 Novemer 2011

recfix now supports a new --sort operation that will physically sort all
the record sets in a given file:

   $ recfix --sort database.rec
  
Hope this helps.

-- 
Jose E. Marchesi    address@hidden
GNU Project         http://www.gnu.org



reply via email to

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