Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Sorting a text file

by McDarren (Abbot)
on Mar 15, 2007 at 09:29 UTC ( [id://604948]=note: print w/replies, xml ) Need Help??


in reply to Sorting a text file

You don't even need Perl for this. Assuming that you are on a *nix system (perhaps a poor assumption), then you could simply do:
sort -nk2 file.txt

Update: It turns out that MS-DOS also has a sort command (I never knew that!). So on a winders system, the following from a command prompt:

sort /+10 file.txt
(Assumes spaces between the 1st and 2nd fields, rather than tabs)

Cheers,
Darren :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://604948]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-03-29 07:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found