- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- find & ll -t can not work together
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2010 12:29 AM
12-03-2010 12:29 AM
find & ll -t can not work together
find . -mtime -32 -exec ll -t {} \;
-rwxrwx--- 1 root dba 12853 Dec 3 16:26 ./starch.file
-rw-r--r-- 1 root sys 0 Dec 3 16:00 ./vol-percent.txt
-rwxrwx--- 1 oraprod dba 486 Dec 3 16:23 ./arch-input-status.log
-rwxrwx--- 1 oraprod dba 83 Dec 3 16:23 ./arch-sequence.log
-rwxrwx--- 1 root dba 27 Dec 3 16:26 ./arch_cp.file
- Tags:
- find
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2010 12:50 AM
12-03-2010 12:50 AM
Re: find & ll -t can not work together
Your expectation from the find command, is, to gather all files to your spec and then run an ll -t on this list. Unfortunately find & exec pair do not work that way.
If you want a chronologically sorted list of files, you need to write a few lines of shell script, using temporary files and whatever else. At this late hour, my brain is not working that nimbly to cobble up something.
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2010 05:31 AM
12-03-2010 05:31 AM
Re: find & ll -t can not work together
Mel's interpretation of you problem is correct. When you use the ";" terminator to 'find's '-exec', only *one* argument at a time (here, one file or directory) is passed to the command that is to be executed.
You can cause 'find -exec' to aggregate a very large number of arguments and pass them as a bundle to the command to be run by using a "+" terminator.
If you aren't going to explicitly specify only files to be returned by 'find' like:
# find . -type f -mtime -32 -exec ls -lt {} +
...then use:
# find . -mtime -32 -exec ls -ltd {} +
...which adds the '-d' switch to 'ls' so that you don't duplicate output when 'ls' examines a directory and rescans the files in it that have already been assimilated.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2010 06:12 AM
12-03-2010 06:12 AM
Re: find & ll -t can not work together
In the "find . -mtime -32 -exec ll -t {} \;" command of the original post, the "find" command produces one "ll -t" command for each file, so the sorting step of the ll command has only 1 file to process each time:
ll -t ./starch.file
ll -t ./vol-percent.txt
etc.
In James's solution, the find command produces one or more command lines like:
ll -t ./starch.file ./vol-percent.txt ...
If the complete list of filenames fits into a single maximum-length command line, the "ll -t" command gets all the files at once and can sort them correctly.
But if the list of filenames is so long that find needs to run two or more command lines, then the files on each command line will be sorted separately. The maximum length of the command line is quite long, but not infinite: see "man 5 limits" for limits ARG_MAX and LINE_MAX. You can use the "getconf" command to view the actual limits on your system.)
This will result in a listing that is made up of multiple "blocks": each block will contain a correctly sorted sub-set, but the time ranges of each block may overlap with other blocks, so the complete list is not guaranteed to be correctly sorted.
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2010 12:51 PM
12-03-2010 12:51 PM
Re: find & ll -t can not work together
Only ARG_MAX is important. LINE_MAX is trivially small but does limit xargs(1).
>so the complete list is not guaranteed to be correctly sorted.
Right.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2010 04:38 PM
12-05-2010 04:38 PM
Re: find & ll -t can not work together
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2010 04:39 PM
12-05-2010 04:39 PM
Re: find & ll -t can not work together
# find . -type f -mtime -32 -exec ls -lt {} +
...then use:
# find . -mtime -32 -exec ls -ltd {} +
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2010 04:04 AM
12-06-2010 04:04 AM
Re: find & ll -t can not work together
> Thank for your help.
If you are satisfied with the answers you received, please read this about assigning points:
http://forums11.itrc.hp.com/service/forums/helptips.do?#28
Regards!
...JRF...