1751878 Members
5457 Online
108782 Solutions
New Discussion юеВ

Re: Powerfull Find

 
SOLVED
Go to solution
Dennis Handly
Acclaimed Contributor
Solution

Re: Powerfull Find

find(1) works two ways depending if UNIX95 is exported. The find(1) describes UNIX95, which isn't the default.
time is now 27:1800
25:0000 2*24:1800 26:0000 1*24:1800 27:0000 0*24:1800
file X file1 X file2 NOW
Default: takes time / day and truncates
2 X 1 X 0
+0 X +0 X X
+1 X X X -1

UNIX95: takes time in seconds and compares N thru N-1 as =, - as < N-1, + as > N
file X file1 X file2 NOW
3 X 2 X 1
+0 X +0 X +0
+1 X +1 X X
+2 X X X -2
Dennis Handly
Acclaimed Contributor

Re: Powerfull Find

If you are happy with the answers you have gotten, please read the following about assigning points:
http://forums.itrc.hp.com/service/forums/helptips.do?#33
AZayed
Super Advisor

Re: Powerfull Find

Hi Dennis,

I didn't understand your last example, can you explain it a little.

Thanks
Success seems to be connected with action. Successful people keep moving. They make mistakes, but they don't quit.
Dennis Handly
Acclaimed Contributor

Re: Powerfull Find

>can you explain it a little.

Which parts? How find(1) works with and without UNIX95?

Default:
25:0000 2*24:1800 26:0000 1*24:1800 27:0000 0*24:1800

This is a timeline, Oct 25, 0000; a time 2 days ago at 1800; then Oct 26, ... Oct 27, then "now at Oct 27, 1800.
Default: takes time / day and truncates

With UNIX95, it does this fuzzy compare that is documented in find(1).
James R. Ferguson
Acclaimed Contributor

Re: Powerfull Find

Hi (again):

> Dennis: With UNIX95, it does this fuzzy compare that is documented in find(1).

And just where in the HP-UX manpages did you find [ no pun intended ] that? I can't seem to locate a reference to either XPG4 or UNIX95 that points at this logic. The GNU Linux manpages are a bit more explicit in stating that "... When find figures out how many 24-hour periods ago the file was last accessed, any fractional part is ignored..."

Regards!

...JRF...

AZayed
Super Advisor

Re: Powerfull Find

Hi,

Thanks for answering, my last question is how to run find command in UNIX95 environment.

Regards,
Success seems to be connected with action. Successful people keep moving. They make mistakes, but they don't quit.
OldSchool
Honored Contributor

Re: Powerfull Find

setting the UNIX95 variable in the command line for find will do it, for example

UNIX95= find . -name testdunce -mtime ....

setting / exporting UNIX95 will also work, but I don't recommend that approach as that variable influences a bunch of different things, like the "ps" command as well, and so could inadvertantly cause havoc.
OldSchool
Honored Contributor

Re: Powerfull Find

also, note that UNIX95= was followed by a space....
AZayed
Super Advisor

Re: Powerfull Find

Thanks,

A lot of useful information & ideas,

Regards,
Success seems to be connected with action. Successful people keep moving. They make mistakes, but they don't quit.
Dennis Handly
Acclaimed Contributor

Re: Powerfull Find

>JRF: And just where in the HP-UX manpages did you find that?

I had to look at the 11.31 sources.

>... When find figures out how many 24-hour periods ago the file was last accessed, any fractional part is ignored..."

That's the default, non UNIX95 functionality.