I have a flat text file. Each line in it contains a "/full path/filename". The last three columns are predictable, but directory depth of each line varies.
I want to sort on the last three columns, starting from the last, 2nd last and 3rd last. In that order. The last three columns have a constant column width:
/../...../.../2009/365/2300.Z
Last col(6): 24h time 0000.Z -> 2300.Z (compressed file)
2nd Last col(3}: Day of Year, 001 -> 365 (366 in leap years)
3rd Last col(4): Year
I'll explain with an example:
desired sort key: last col, 2nd last col, 3rd last col
As you can see, the number of columns in this example vary, however, regardless the number of columns, I would like to sort the lines based on last, 2nd last & 3rd last columns, the results should look like this:
Awesome, that did it. I keep forgetting the valuable magic (and complexity) of perl.
A thousand thank-you's.
J.
Scrutinizer:
The 'sed' command example did sort from low day of year to highest in each sub-directory. However, I blame my poor wording of my original question. What I needed in the output was a total sort of all file names in a quasi-chronological order (based on filename), oldest first so the output would contain the oldest files, regardless of subdirectory depth, at the top of the file.