Sponsored Content
Operating Systems HP-UX find -mtime giving strage results in HP-UX Post 302377102 by Chetanaz on Thursday 3rd of December 2009 06:36:55 AM
Old 12-03-2009
find -mtime giving strage results in HP-UX

Hi,

I am using HP-UX B.11.23 U ia64

I am trying to retrieve files using -mtime option of find command

However I found that -mtime is not giving correct results

Following is the output of commands executed on 03-Dec-2009

It can be seen that -mtime +1 should have returned all files from "Dec 2" backwards
However it is listing files from "Nov 26" backwards

Similarly -mtime +1 should have returned all files from "Nov 26" backwards
instead the command is listing files "Nov 24" backwards

What could be the reason?

Does -mtime starts with last day of last month backwards in HP-UX?

Thanks and Regards,
Chetana

Quote:
oracle@dev1:/u01/data/DB01/archive1 $ls -ltr
total 15116040
-rw-r----- 1 oracle dba 209714176 Nov 20 13:49 DB01_0001_0000000235.arc
-rw-r----- 1 oracle dba 209714176 Nov 20 14:10 DB01_0001_0000000236.arc
-rw-r----- 1 oracle dba 209714176 Nov 20 14:29 DB01_0001_0000000237.arc
-rw-r----- 1 oracle dba 209714176 Nov 20 14:47 DB01_0001_0000000238.arc
-rw-r----- 1 oracle dba 209714176 Nov 21 08:30 DB01_0001_0000000239.arc
-rw-r----- 1 oracle dba 209714176 Nov 23 21:34 DB01_0001_0000000240.arc
-rw-r----- 1 oracle dba 2048 Nov 24 07:48 DB01_0002_0000000001.arc
-rw-r----- 1 oracle dba 2048 Nov 24 08:41 DB01_0002_0000000002.arc
-rw-rw---- 1 oracle dba 209714176 Nov 26 05:23 DB01_0001_0000000041.arc
-rw-rw---- 1 oracle dba 209714176 Nov 26 05:55 DB01_0001_0000000042.arc
-rw-rw---- 1 oracle dba 209714176 Nov 26 05:56 DB01_0001_0000000043.arc
-rw-rw---- 1 oracle dba 160875520 Nov 30 11:10 DB01_0001_0000000056.arc
-rw-rw---- 1 oracle dba 6833152 Dec 1 18:36 DB01_0001_0000000001.arc
-rw-rw---- 1 oracle dba 880640 Dec 1 19:43 DB01_0001_0000000002.arc
-rw-rw---- 1 oracle dba 1668096 Dec 1 21:47 DB01_0001_0000000003.arc
-rw-rw---- 1 oracle dba 1844224 Dec 2 00:04 DB01_0001_0000000004.arc
-rw-rw---- 1 oracle dba 69372928 Dec 2 01:19 DB01_0001_0000000005.arc
-rw-rw---- 1 oracle dba 299008 Dec 2 01:41 DB01_0001_0000000006.arc
-rw-rw---- 1 oracle dba 85476352 Dec 2 19:05 DB01_0001_0000000026.arc
-rw-rw---- 1 oracle dba 209714176 Dec 3 08:56 DB01_0001_0000000027.arc
-rw-rw---- 1 oracle dba 209713152 Dec 3 09:03 DB01_0001_0000000028.arc
-rw-rw---- 1 oracle dba 209711104 Dec 3 09:09 DB01_0001_0000000029.arc

oracle@dev1:/u01/data/DB01/archive1 $find . -name "*.arc" -mtime +1 -exec ls -ltr {} \;

-rw-r----- 1 oracle dba 209714176 Nov 20 13:49 DB01_0001_0000000235.arc
-rw-r----- 1 oracle dba 209714176 Nov 20 14:10 DB01_0001_0000000236.arc
-rw-r----- 1 oracle dba 209714176 Nov 20 14:29 DB01_0001_0000000237.arc
-rw-r----- 1 oracle dba 209714176 Nov 20 14:47 DB01_0001_0000000238.arc
-rw-r----- 1 oracle dba 209714176 Nov 21 08:30 DB01_0001_0000000239.arc
-rw-r----- 1 oracle dba 209714176 Nov 23 21:34 DB01_0001_0000000240.arc
-rw-r----- 1 oracle dba 2048 Nov 24 07:48 DB01_0002_0000000001.arc
-rw-r----- 1 oracle dba 2048 Nov 24 08:41 DB01_0002_0000000002.arc
-rw-rw---- 1 oracle dba 209714176 Nov 26 05:23 DB01_0001_0000000041.arc
-rw-rw---- 1 oracle dba 209714176 Nov 26 05:55 DB01_0001_0000000042.arc
-rw-rw---- 1 oracle dba 209714176 Nov 26 05:56 DB01_0001_0000000043.arc


oracle@dev1:/u01/data/DB01/archive1 $find . -name "*.arc" -mtime +7 -exec ls -ltr {} \;
-rw-r----- 1 oracle dba 2048 Nov 24 07:48 ./DB01_0002_0000000001.arc
-rw-r----- 1 oracle dba 2048 Nov 24 08:41 ./DB01_0002_0000000002.arc
-rw-r----- 1 oracle dba 209714176 Nov 20 13:49 ./DB01_0001_0000000235.arc
-rw-r----- 1 oracle dba 209714176 Nov 20 14:10 ./DB01_0001_0000000236.arc
-rw-r----- 1 oracle dba 209714176 Nov 20 14:29 ./DB01_0001_0000000237.arc
-rw-r----- 1 oracle dba 209714176 Nov 20 14:47 ./DB01_0001_0000000238.arc
-rw-r----- 1 oracle dba 209714176 Nov 21 08:30 ./DB01_0001_0000000239.arc
-rw-r----- 1 oracle dba 209714176 Nov 23 21:34 ./DB01_0001_0000000240.arc

Last edited by Chetanaz; 12-03-2009 at 07:38 AM.. Reason: formatting
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script giving wrong results....

hi, I have this script which gives me the result... #! /usr/bin/sh set -x cd /home/managar a=1 while true do if then echo " File log.txt exists in this directory " exit 0 fi echo " File has not arrived yes..." sleep 3 let a=a+1 if then (1 Reply)
Discussion started by: mgirinath
1 Replies

2. UNIX for Dummies Questions & Answers

find . -mtime

...what am i doing wrong?? I need to find all files older than 30 days and delete but I can't get it to pull details for ANY + times. The file below has a time stamp which is older than 1 day, however if I try and select it using any of the -time flags it just doesn't see it. (the same thing... (1 Reply)
Discussion started by: topcat8
1 Replies

3. Shell Programming and Scripting

egrep not giving desired results

I have written a shell script which looks like below: grep -v ',0,' ./DATA/abc.001 > ./DATA/abc.mid egrep $GREPSEARCH ./DATA/ebc.mid > ./DATA/abc.cut the variable GREPSEARCH has values like the below: ... (3 Replies)
Discussion started by: igandu
3 Replies

4. Shell Programming and Scripting

awk script giving unstable results

Hi all Here I came accross a situation which i am unable to reason out... snippet 1 psg ServTest | grep -v "grep" | grep -v "vi" | awk '{ pgm_name=$8 cmd_name="ServTest" gsub(/]*/,"",pgm_name) if(pgm_name==cmd_name) { print "ServTest Present =" cmd_name} }'... (10 Replies)
Discussion started by: Anteus
10 Replies

5. UNIX for Dummies Questions & Answers

(find) mtime vs. (unix) mtime

Hi I've made some test with perl script to learn more about mtime... So, my question is : Why the mtime from findfind /usr/local/sbin -ctime -1 -mtime -1 \( -name "*.log" -o -name "*.gz" \) -print are not the same as mtime from unix/linux in ls -ltr or in stat() function in perl : stat -... (2 Replies)
Discussion started by: hiddenshadow
2 Replies

6. Shell Programming and Scripting

find -mtime +7

Dear all, find $ADMIN_DIR/$SID/arch/ -name '*.gz' -mtime +7 -exec rm {} \; is it retaining 7 days OR 8 days .gz files ? Thanks Prakash (10 Replies)
Discussion started by: prakashoracledb
10 Replies

7. Shell Programming and Scripting

Sed in vi - \r and \n not giving desired results

I use many different machines at work, each with different versions of o/s's and installed applications. Sed in vi is particularly inconvenient in the sense that sometimes it will accept the "\r" as a carriage return, sometimes not. Same thing with "\n". For instance, if I have a list of hosts... (7 Replies)
Discussion started by: MaindotC
7 Replies

8. UNIX for Dummies Questions & Answers

Find using mtime

Hi, so I was using mtime and its not behaving the way I would think its supposed too. I have two pdf files. One modified today and another 6 months ago. I upload them to the solaris server. Then I run the below find statements. This finds my 2 files find *.pdf -type f -name '*.pdf' this finds... (2 Replies)
Discussion started by: vsekvsek
2 Replies

9. UNIX for Dummies Questions & Answers

Grep not giving expected results

Version: RHEL 5.8 I am doing a grep of the piped output from ps command as shown below. I am grepping for the pattern ora_dbw* . But, in the result set I am seeing strings with ora_dbr* as well like ora_dbrm_SDLM1DAS3 as shown below. Any idea why is this happening ? $ ps -ef | grep... (6 Replies)
Discussion started by: John K
6 Replies

10. Shell Programming and Scripting

Comm giving unexpected results

Hi I am comparing two files with comm -13 < (sort acc11.txt) < (sort acc12.txt) > output.txt purpose: Get non matching records which are in acc12 but not in acc11... TI am getting WRONG output. Is there any constraints with record length with comm? The above files are the two consective ... (2 Replies)
Discussion started by: vedanta
2 Replies
All times are GMT -4. The time now is 07:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy