Results 1 to 3 of 3
I'm trying to figure out how to pipe the current directory listing into sort so that the output is the date in descending order (primary sort key). If there are ...
- 10-20-2010 #1Just Joined!
- Join Date
- Oct 2010
- Posts
- 2
Sort Command - Aescending and Descending Sort
I'm trying to figure out how to pipe the current directory listing into sort so that the output is the date in descending order (primary sort key). If there are multiple entries with the same date, I'd like the times sorted in ascending order.
It seems simple but for some reason this isn't working:
ls -l | sort -k 6r -k 7
For some reason it doesn't seem to ever get to the second sort key when using column 6 (last modified date).
Thanks in advance!
- 10-20-2010 #2Just Joined!
- Join Date
- Oct 2010
- Posts
- 2
Problem solved! Was a lot more complicated than I thought, but I figured out a solution. It's a homework question and I know a few people from my class browse these forums so I'll post the solution tomorrow
.
Last edited by pacapaca; 10-20-2010 at 06:48 PM.
- 10-24-2010 #3
If your homework is an exercise in how to read a man page, it would have told you that the sort order of files listed can be by time, using the '-t' argument, and that it can be given in reverse order, by adding the '-r' argument. If it was an exercise in using sort , then good for you to have a solution.
--- rod.Stuff happens. Then stays happened.


