Re: Sort Problem!

From: William James (w_a_x_man_at_yahoo.com)
Date: 08/25/05


Date: 25 Aug 2005 09:46:47 -0700

beholder_67@yahoo.com wrote:
> Hello! I would like to sort a huge ascii file like this:
>
> Example:
>
>
> 412 five zero six eleven
> 540 rolex
> 076 Munich
> 090 I-2000-18
> 079 verfuegbar
>
> 027 ident
> 100 Allan Collins
> 104 Edward E. Smith
> 331 Readings
>
> 027 M:S89-004
> 100 B.J. Grosz
> 104 K. Sparck Jones
> 108 B.L. Webber
> 331 Readings in Natural Language Processing
> 425 1986
> 412 Los Altos
>
> My problem is the blank line between the 32434 blocks of data. (Its
> bibliographic data...)

ruby -pae'BEGIN{$/="\n\n";$;="\n"};$_=$F.sort.join("\n")+"\n\n"' file

Awk:

BEGIN{RS=""}
{ print $0 | "sort"
  close( "sort" )
  print ""
}



Relevant Pages

  • Re: Sort Problem!
    ... > 412 five zero six eleven ... > 540 rolex ... > 076 Munich ... > 331 Readings in Natural Language Processing ...
    (comp.unix.shell)
  • Re: Daily Averages
    ... Don Guillett ... Microsoft MVP Excel ... If i dont have any reading it´s equal to zero. ... this column is equal to the days when the readings ...
    (microsoft.public.excel.misc)
  • Re: Daily Averages
    ... If i dont have any reading it´s equal to zero. ... Sub GetDailyAverage() ... Loop While Not c Is Nothing And c.Address firstAddress ... Column B is the readings column. ...
    (microsoft.public.excel.misc)
  • Re: FILE Operations
    ... This is in response to Emmanuel Delahaye's comments: ... memset is needed to set the positions to zero otherwise for the 2nd, 3rd, ... readings you'll mix it with prior readings. ...
    (comp.lang.c)