LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   find command uses different format for results in 10.04 lts and 8.04 lts (https://www.linuxquestions.org/questions/ubuntu-63/find-command-uses-different-format-for-results-in-10-04-lts-and-8-04-lts-878970/)

koloth 05-05-2011 06:16 AM

find command uses different format for results in 10.04 lts and 8.04 lts
 
Hello,
I have created a piece of sw which at some point executes the find command with some parameters and parses the results. It works fine on 8.04 but i get a slighlty different behaviour from find in 10.04. Specifically if i request using printf to display the last time a file was accessed, in 8.04 i get it in integer format while in10.04 i get it in float. What is the reason? I have a feeling it is not a find version issue. Is there a way to get 10.04 to behave like 8.04?
Here is the command and the result in 10.04
Code:

/usr/bin/find /tmp -type f -printf '%p\t%s\t%A@\n'
/tmp/debug.xml    37079    1304582201.5116502900
/tmp/webpage    0    1304581917.0505157280

And how it is on 8.04
Code:

/usr/bin/find /tmp -type f -printf '%p\t%s\t%A@\n'
/tmp/webpage    59906    1304591677
/tmp/50K_1    51200    1304547070

Any help would be appreciated,
Thanks

druuna 05-05-2011 08:19 AM

Hi,

Quote:

Originally Posted by koloth
I have a feeling it is not a find version issue.

And I have a feeling it is :)

Code:

# On an old box:
$ find --version
GNU find version 4.2.27

$ find /tmp -type f -printf '%p\t%s\t%A@\n'
/tmp/NOSC      393    1304595008
/tmp/.X0-lock  11      1304575960

# On a recently installed box:
$ find --version
find (GNU findutils) 4.4.2

$ find /tmp -type f -printf '%p\t%s\t%A@\n'
/tmp/kvm.start.a.vm.sh.bak  1703    1304601282.0000000000
/tmp/foo        0      1304601269.0000000000

Hope this helps.

koloth 05-05-2011 08:51 AM

Well you are right although i cannot find the change in the findutils changelog...

Thanks for the answer


All times are GMT -5. The time now is 10:10 PM.