sorting a file with records - amended

Discussion in 'Perl' started by mike, Nov 13, 2003.

  1. mike

    mike Guest

    hi

    i have a sample file like this (field separator is a space):


    orion 13-11-2003 mike
    jupiter 11-11-2003 susan
    venus 12-11-2002 alvin
    neptune 10-11-2002 sharon

    i just want to sort this file on the first column by string so
    eventaully the output is:

    jupiter 11-11-2003 susan
    neptune 10-11-2002 sharon
    orion 13-11-2003 mike
    venus 12-11-2002 alvin

    how can i do that just with the sort function from perl??
    thanks very much for any help
    mike, Nov 13, 2003
    #1
    1. Advertising

  2. mike wrote:
    > i have a sample file like this (field separator is a space):
    >
    > orion 13-11-2003 mike
    > jupiter 11-11-2003 susan
    > venus 12-11-2002 alvin
    > neptune 10-11-2002 sharon
    >
    > i just want to sort this file on the first column by string so
    > eventaully the output is:
    >
    > jupiter 11-11-2003 susan
    > neptune 10-11-2002 sharon
    > orion 13-11-2003 mike
    > venus 12-11-2002 alvin
    >
    > how can i do that just with the sort function from perl??
    > thanks very much for any help


    Was it anything particular in the documentation for the sort function
    that you did not understand? Or don't you know where you find the docs?

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Hjalmarsson, Nov 13, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Luke Airig
    Replies:
    0
    Views:
    786
    Luke Airig
    Dec 31, 2003
  2. jon
    Replies:
    2
    Views:
    301
  3. Dan

    Delete records or update records

    Dan, May 10, 2004, in forum: ASP General
    Replies:
    1
    Views:
    460
    Ray at
    May 10, 2004
  4. Replies:
    3
    Views:
    653
    Anthony Jones
    Nov 2, 2006
  5. jon
    Replies:
    7
    Views:
    132
    Neil Gould
    Dec 18, 2008
Loading...

Share This Page