Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Sorting a text file

by McDarren (Abbot)
on Mar 15, 2007 at 09:29 UTC ( #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? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2022-08-08 19:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?