Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian User (http://www.linux-archive.org/debian-user/)
-   -   Does find subdir -printf "%A " a bad example which is mentioned in the documentation? (http://www.linux-archive.org/debian-user/650165-does-find-subdir-printf-bad-example-mentioned-documentation.html)

Regid Ichira 03-29-2012 02:12 AM

Does find subdir -printf "%A " a bad example which is mentioned in the documentation?
 
$ zgrep -A3 '%A%p' /usr/share/info/find.info.gz
newest=$(find subdir -newer timestamp -printf "%A%p
" |
sort -n |
tail -1 |
cut -d: -f2- )

is taken from findutil's (4.4.2-4) documentation. It doesn't work
here:

$ mkdir -v subdir
mkdir: created directory `subdir'
$ touch subdir/file
$ find subdir -printf "%A%p
"
%p
%p
$ find subdir -printf "%A
"
%
%
$

I think the documentation's example assumes "%A
" is supposed to
print time information as is. While, in fact, there must be a
modifier after the 'A'. Does

find subdir -printf "%A
"

print time information for you? Am I right that the documentation's
example assume it should work as is?
Does the example also bad with respect to "%p"? If so, what is the
correct formatting?


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 1332987136.79855.YahooMailClassic@web120705.mail.n e1.yahoo.com">http://lists.debian.org/1332987136.79855.YahooMailClassic@web120705.mail.n e1.yahoo.com

Paul E Condon 03-29-2012 03:26 AM

Does find subdir -printf "%A " a bad example which is mentioned in the documentation?
 
On 20120328_191216, Regid Ichira wrote:
> $ zgrep -A3 '%A%p' /usr/share/info/find.info.gz
> newest=$(find subdir -newer timestamp -printf "%A%p
" |
> sort -n |
> tail -1 |
> cut -d: -f2- )
>
> is taken from findutil's (4.4.2-4) documentation. It doesn't work
> here:
>
> $ mkdir -v subdir
> mkdir: created directory `subdir'
> $ touch subdir/file
> $ find subdir -printf "%A%p
"
> %p
> %p
> $ find subdir -printf "%A
"
> %
%
$
>
> I think the documentation's example assumes "%A
" is supposed to
> print time information as is. While, in fact, there must be a
> modifier after the 'A'. Does
>
> find subdir -printf "%A
"
>
> print time information for you? Am I right that the documentation's
> example assume it should work as is?
> Does the example also bad with respect to "%p"? If so, what is the
> correct formatting?

find subdir -printf "%Ap
" prints AM or PM depending on the file's
access time in the local time zone of the computer. You string together
a bunch of %A each followed by a single letter from the list of letters
just below the %A under -printf in the man page to get a useful printing
of the file access time. i.e. there must be a 'k' and 'k' must be one
of the characters from that list ( including k can be @ even though @
is above the column heading of allowed k values ) I know this is confusing.
Try testing with
find subdir -printf "%A@ %Ap
"
and see a somewhat useless but educational, I hope.
In place of the space in this trial, put a hyphen [-]
Try
find subdir -printf "%A@ %Ap %f
"
to include the base name of the file without the path from subdir.
Look at
find subdir -printf "%i %b %M %n %U %G %s %TY%Tm%Td_%TH%TM%TS %p
"
This is one I use and find convenient for some work. Figure out how it
works, and then write, and contribute a better man page. I would have
appreciated it when I was learning, but now that I know the truth I
can't see a better way to say it than is already there.

Enjoy ?-)
--
Paul E Condon
pecondon@mesanetworks.net


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20120329032600.GC8146@big.lan.gnu">http://lists.debian.org/20120329032600.GC8146@big.lan.gnu


All times are GMT. The time now is 03:03 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.