Operating System - HP-UX
1836561 Members
1763 Online
110102 Solutions
New Discussion

How to sort the output generated by find?

 
SOLVED
Go to solution
zhaogui
Super Advisor

How to sort the output generated by find?

I want to sort the output generated by find as shown below,
find . -name "test*" -exec ls -lt {} \;|sort -k6,6 -k7,7 -k8,8.

But it seems it doesn't work. Can anybody help me?
3 REPLIES 3
zhaogui
Super Advisor

Re: How to sort the output generated by find?

To add on, I want to sort by timestamp.
Robin Wakefield
Honored Contributor
Solution

Re: How to sort the output generated by find?

Hi,

You are trying to output in date/time order, so I'd do it like this:

find . -name "test*" | xargs ls -ltr

Rgds, Robin.
zhaogui
Super Advisor

Re: How to sort the output generated by find?

Thanks.