sort a file
BlitzMax Forums/BlitzMax Beginners Area/sort a file
| ||
hi ! i've a .bmx source file, i need sort it. Is there a tool to do this ? The file contains this kind of lines : TL.Create (566,"bullet ","") TL.Create (030,"ship ","") TL.Create (079,"weapon ","") i want just sort by numbers ascending like this. TL.Create (030,"ship ","") TL.Create (079,"weapon ","") TL.Create (566,"bullet ","") Thanks for your ideas |
| ||
Would it not be simpler to have the data stored in a text file (inbin'd if you like), and parse it at runtime? That way you wouldn't have a need to sort source-code :-p How's about this: sort -n myfile.bmx > newfile.bmx example: xxxxxxxxxx:~> cat sorttest.txt TL.Create (566,"bullet ","") TL.Create (030,"ship ","") TL.Create (079,"weapon ","") xxxxxxxxxx:~> sort -n sorttest.txt TL.Create (030,"ship ","") TL.Create (079,"weapon ","") TL.Create (566,"bullet ","") |
| ||
Thanks brucey, the os sort function do the job ! |
| ||
nice OS calls! |