Customized sorting via regular expressions
Posted: Wed Aug 31, 2005 8:23 pm
There are many times where I want to sort a set of data by a string that is not at the beginning of a line. For example I would like to sort timestamped log files by file name or my FireFox Bookmarks by Title. While I usually write a perl script to do this, it seems the functionality could be elegantly implemented in TextPad's sort. If you could specify a POSIX regular expression string to sort by, that would take care of it.
So for a log file you could specify:
GET /[^ ]+
and it would sort by file name
It would be even more useful if you could specify multiple criteria with parentheses like
(\d{4}-\d{2}-\d{2}).*(GET /[^ ]+)
Order: 2,1
To sort by file name and then by date.
This would make this application much more powerful for many uses and would increase my allegiance to it.
So for a log file you could specify:
GET /[^ ]+
and it would sort by file name
It would be even more useful if you could specify multiple criteria with parentheses like
(\d{4}-\d{2}-\d{2}).*(GET /[^ ]+)
Order: 2,1
To sort by file name and then by date.
This would make this application much more powerful for many uses and would increase my allegiance to it.