- Community Home
- >
- Servers and Operating Systems
- >
- Legacy
- >
- Operating System - Tru64 Unix
- >
- printf utility and find command
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
Discussions
Forums
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
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
тАО05-19-2017 10:08 AM
тАО05-19-2017 10:08 AM
printf utility and find command
Hello All,
I am trying to generate a filelist and generate details of files like md5sum, size, date created, accessed, modified etc ... using the following command... but it throws the error printf not found ... any suggestions ?
find . -printf "%p\t%s\t%M\t%u\t%g\t%.24A+\t%.24T+\t%.24C+\t" -a \( -type d -exec echo \; -o -type f -exec sh -c "md5sum \"{}\" | cut -d' ' -f1" \; \)
- Tags:
- find
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-19-2017 10:43 AM
тАО05-19-2017 10:43 AM
Re: printf utility and find command
> I [...]
uname -a
sizer -v
> [...] but it throws the error printf not found [...]
First, I'd trust copy+paste of an actual command with its actual
output more than your summary. For example, I don't see how "find
-printf" could give that error, but...
"find -printf" (or "printf" as a command) is a feature which is
likely too new for Tru64 (which is getting very old, and has not gotten
much development in recent years). If you can't get what you want from
an "ls" command (or mutiple "ls" commands), then you might look into
building GNU "find" (or finding it already built for Tru64), and using
it instead of the built-in Tru64 "find".
https://www.gnu.org/software/findutils/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-19-2017 04:16 PM
тАО05-19-2017 04:16 PM
Re: printf utility and find command
> https://www.gnu.org/software/findutils/
Seems to work for me (more or less):
urtx# /usr/local/bin/find --version
find (GNU findutils) 4.6.0
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Eric B. Decker, James Youngman, and Kevin Dalley.
Features enabled: O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS(FTS_CWDFD) CBO(level=2)
urtx# /usr/local/bin/find -name 'siz*' -printf "%p\t%s\t%M\t%u\t%g\t%.24A+\t%.24T+\t%.24C+\t\n"
./siz.c 190 -rw-r--r-- root system %F+07:45:04.0000000000 %F+12:49:06.0000000000 %F+12:49:06.0000000000
./siz2.c 251 -rw-r--r-- root system %F+07:46:30.0000000000 %F+07:46:18.0000000000 %F+07:46:18.0000000000
./siz 20000 -rwxr-xr-x root system %F+14:01:42.0000000000 %F+12:49:14.0000000000 %F+12:49:14.0000000000
./siz2 20000 -rwxr-xr-x root system %F+17:14:44.0000000000 %F+07:46:31.0000000000 %F+07:46:31.0000000000
urtx# uname -a
OSF1 urtx.antinode.info V5.1 2650 alpha
urtx# sizer -v
HP Tru64 UNIX V5.1B (Rev. 2650); Wed Feb 17 22:59:59 CST 2016
urtx# gcc --version
gcc (GCC) 4.3.2
[...]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-22-2017 06:32 AM
тАО05-22-2017 06:32 AM
Re: printf utility and find command
Thanks Steven,
Let me try the same out and will inform you/all of the outcome.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-22-2017 10:40 AM
тАО05-22-2017 10:40 AM
Re: printf utility and find command
> Let me try the same out and will inform you/all of the outcome.
GNU findutils is a start, but you may need to do more than I did if
you want to get that "%F" interpreted properly. I haven't looked at the
"find" code (or builders), so I know nothing, but I'd guess that you'd
also need either a GNU "date" program or some piece of GNU run-time
library which is used to format those date-time values. Apparently,
someone ("find") expects someone (else, unknown) to support a "%F"
format specification, but the Tru64 version of that function/program
doesn't recognize "%F" as anything special.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-23-2017 02:19 PM
тАО05-23-2017 02:19 PM
Re: printf utility and find command
The command was still showing some printf error related to predicate list ( I am thinking either I am not quoting properly or inserting some space somewhere ) ...
I installed the GNU find utils, GNU core utils, GCC , changed the path to reflect the GNU Utils, still erring on printf predicate list, so kicked the printf out of the way and used the ls command with ls -lu, ls -lc options and got the job done. I dont have a HP UX box to test the different commands unfortunately...
This command would work for sure ...
find . -printf "%p\t%s\t%M\t%u\t%g\t%AY-%Am-%Ad:%AH:%AM:%AS\t%TY-%Tm-%Td:%TH:%TM:%TS\t%CY-%Cm-%Cd:
%CH:%CM:%CS\t" -a \( -type d -exec echo \; -o -type f -exec sh -c "md5sum \"{}\" | cut -d' ' -f1" \; \)
regardless thanks a lot for your suggestions Steven ... :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-23-2017 05:29 PM
тАО05-23-2017 05:29 PM
Re: printf utility and find command
> GNU findutils is a start, but you may need to do more than I did if
> you want to get that "%F" interpreted properly. I haven't looked at the
> "find" code (or builders), so I know nothing, but I'd guess that you'd
> also need either a GNU "date" program or some piece of GNU run-time
> library which is used to format those date-time values. Apparently,
> someone ("find") expects someone (else, unknown) to support a "%F"
> format specification, but the Tru64 version of that function/program
> doesn't recognize "%F" as anything special.
I looked at it a little, and decided that the likely culprit was
strftime(). The Tru64 strftime() is too old/lame to do "%F".
Interestingly, the findutils kit includes a strftime.c, but it seems to
be built with special options to provide an nstrftime() (and/or other
extra-feature varients), but not a plain GNU strftime().
My quick evaluation is that this is a bug in GNU findutils (if they
want to support Tru64, that is). The config.h says HAVE_STRFTIME, but
it's not clear that anyone cares, and the old/lame Tru64 strftime()
can't do what is expected of it by the GNU "find" code.
What I enjoy most about GNU code is the way that any piece of GNU
code seems to drag in at least two other pieces of GNU code, and so on.