Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > sorting a file with records - amended

Reply
Thread Tools

sorting a file with records - amended

 
 
mike
Guest
Posts: n/a
 
      11-13-2003
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
 
Reply With Quote
 
 
 
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      11-13-2003
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Redirect if passed parameter has been amended by a user to something not in database. jon ASP General 7 12-18-2008 08:14 PM
Redirect if passed perameter has been amended by user to something not in database jon ASP .Net 2 12-18-2008 02:33 PM
Delete records or update records Dan ASP General 1 05-10-2004 01:25 PM
match muliple header records to associated detail records Luke Airig XML 0 12-31-2003 12:06 AM
sorting a file with records mike Perl 2 11-18-2003 12:15 AM



Advertisments