Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: sorting headers in a file

by hdb (Monsignor)
on Dec 13, 2013 at 07:10 UTC ( [id://1066990]=note: print w/replies, xml ) Need Help??


in reply to sorting headers in a file

For the sorting, the file needs to be small enough to be read into memory. If not, I would suggest to make use of some kind of database.

In order to split your data into the individual records, you could set the special variable $/ to the value ">or". This way, when you read your file, you get it in the chunks that you need. You would then retrieve the number at the beginning of each chunk (e.g. by regex), sort it, and print it.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-04-24 01:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found