Sort files by substring of filename


I installed multiple Oracle products and install logs were created on multiple drives and folders.It's not hard to search them in Windows but I could not find a way to sort.Oracle installer embeds timestamp in filename so I decided to sort files by timestamp in filename.

Thanks stackoverflow again for a hint. This is a quick and dirty one liner in Cygwin. I just assumed TAB will not be used in filenames.

$ cat /dev/clipboard"C:/app/middleware/Oracle_BI1/cfgtoollogs/oui/installActions2015-10-20_06-45-01-PM.log""F:/Program Files/Oracle/Inventory/logs/installActions2015-10-16_11-58-24AM.log""C:/Program Files/Oracle/Inventory/logs/installActions2015-10-16_01-59-23PM.log"$ sed 's//(2015-..-.._/)/(..-..-..-*/)/([AP]M/)//t/1/t/2/t/3/' /> /dev/clipboard | sort -t ' ' -k 2,2 -k 4,4.1 -k 3 |> sed 's//t//g'"F:/Program Files/Oracle/Inventory/logs/installActions2015-10-16_11-58-24AM.log""C:/Program Files/Oracle/Inventory/logs/installActions2015-10-16_01-59-23PM.log""C:/app/middleware/Oracle_BI1/cfgtoollogs/oui/installActions2015-10-20_06-45-01-PM.log"

I didn't know that UN*X sort works very differently from SQL's "ORDER BY 1,2,3"