At 10:37 -0700 7/5/10, Warren Michelsen wrote: >I have tables containing data in reverse chronological order. I'd like it to >be chronological so I'm thinking I can just move the table rows around. > >Seems like it would require a separate scratch file to hold the re-ordered >rows until all rows have been copied, then replace the selection with the >re-ordered rows. > >I.e., Take the last table row (cutting or removing it) from the selection and >move it to the scratch area. > >Take the last table row and move it to the end of the scratch area. >Lather, rinse, repeat until all rows have been cut from the original >Then move the scratch contents to the original document. > >I'm guessing that Perl is the best tool for this job. It has a reverse >function so I'm guessing that the original selection could be read into an >array, using "<tr" and "/tr>" as delimiters, then regurgitated in reverse >order of the original.
If the stuff between <tr> and </tr> has a numeric value or a date between embedded in the rows with <td> and </td> flags it would be fairly simple to store each row in a perl hash keyed to the date item. It's then a standard operation to pick up the keys in a sorted array which can be sequentially used to recall the strings from the hash in any order you want. I have done things like that but it's probably easier to start afresh than to look for old code. Ask. off line but leave the subject as-is to get by filters. -- --> Give me liberty or give me Obamacare <-- -- You received this message because you are subscribed to the "BBEdit Talk" discussion group on Google Groups. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/bbedit?hl=en If you have a feature request or would like to report a problem, please email "[email protected]" rather than posting to the group.
