You are not logged in.
I have a bunch of html files (chapters of an online book) I want to feed htmldoc. The problem I have is that the output of locate goes 1, 10, 11, 12, ..., 19, 2, 20, 21, .... and so on. What program can I use so that the locate output (variable htmldoc is using in the script) is in the right order?
Offline
Offline
I forgot to mention, in locates output it's chapter1, chapter10, and so on. I've tried sort, but I don't see anything about restricting the sorting to only letters. Can sort ignore letters, or do I need to use something like sed to strip out the "chapter" prefix in the file name and then put it back in after sort is done?
Offline
If all the files start with 'chapter' you can use
sort -k1.8n
The argument(k) is sorting the first field (1), starting at the 8th character(.8) and sorting that numerically (n).
Offline
Got it! Thanks everyone.
Last edited by omgwtfbyobbq (2010-12-15 01:03:03)
Offline
Moved to Workstation User, omgwtfbyobbq please mark your thread solved by prepending it to the title.
ᶘ ᵒᴥᵒᶅ
Offline