03-20-2015
Hello RudiC,
Yeah you are right,im saw few threads using touch and -newer option,the thing is, im not suppose to create any file in that dir,thats the reason i didnt go for that.
Hello Ravi,
Just an example of mmin in my unix box.I have hp ux 11.3
$ find . -mmin -60 -size 0
find: bad option -mmin
your solution would throw an error ,anyways i ll keep trying
I used something like this earlier
dir="/home/user"
found=`find "$dir" -type f \( -mtime +7200 -o -size 0 \)`
if [ -n "$found" ]; then
echo "There are files older than 2 hours OR with size 0:
$found"
fi
then realized mmin doesnt work for me.Thanks iI llwork on finding some alternative
Last edited by haadiya; 03-20-2015 at 08:57 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I'm using k-shell in unix and I want to create a file with the current system time - 60 minutes. I know I can use touch to create the file, but I'm having trouble specifying how tell it to use the current time less 60 minutes. Any ideas??? (4 Replies)
Discussion started by: DaveyTN
4 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I'm new to unix,I wanna know how can I compare timestamp of a file with its touched version.i.e I want to be sure if the touch command has worked properly i.e if the file has been touched then a msg should be printed saying success else failure.All this to be incurred in a script.
Any... (2 Replies)
Discussion started by: prince258
2 Replies
3. Shell Programming and Scripting
Hi,
Time till when the application should run is indicated in a file. First line is hour and second line is minute.
file:
10
55
Means my application should run till 10:55.
Now in a shell script, i am trying to make that logic but with no luck.
min=`tail -n 1 /file_with_time`... (1 Reply)
Discussion started by: SGD
1 Replies
4. AIX
I want to read a log file from a particular location.In the logfile , lines contains timestamp.I need to compare the timestamp in the logfile with the current date.If the timpestamp in the log file is less than 4 hours then i need to read the file from that location.Below is the file format.Please... (1 Reply)
Discussion started by: achu
1 Replies
5. AIX
I want to read a log file from a particular location.In the log file each line starts with timestamp.I need to compare the timestamp in the logfile with the current date.If the timpestamp in the log file is less than 4 hours then i need to read the file from that location.Below is the file... (1 Reply)
Discussion started by: achu
1 Replies
6. Shell Programming and Scripting
Hello,
I've created the script below to compare the content of two files with a delay of an hour. After an hour, the lines that exist in both files, will be printed and executed.
The script now uses a counter to countdown 50 minutes. But what I would prefer is to check the file timestamp of... (3 Replies)
Discussion started by: taipan
3 Replies
7. Shell Programming and Scripting
I'm trying to compare 2 dates between current time and the timestamp on a file.
The date format is mmdd
Both return Apr 1 but when using if statement
line 11: Apr 1: command not found error is returned
#!/bin/sh
log="DateLog"
Current_Date=`date +%b%e`
Filepmdate=`ls -l /file.txt |... (1 Reply)
Discussion started by: cillmor
1 Replies
8. Shell Programming and Scripting
Below is the sample file:
287 DEBUG syndesis.pb.util.ITraceManager - syOID=ELntNetwork:1005Mon Oct 15 17:18:21 IST 2012 <ELClientManagerenEmsSession() > Setting Java Properties
287 DEBUG syndesis.pb.util.ITraceManager - syOID=ELntNetwork:1005Mon Oct 15 17:18:21 IST 2012... (1 Reply)
Discussion started by: ashok.kumar
1 Replies
9. Shell Programming and Scripting
Hi Friends,
I have the following logfile. Currently time in india is 07/31/2014 12:33:34 and i have the following content in logfile. I want to display only those entries which contain string 'Exception' within last 3 hours. In this case, it would be the last line only
I can get the... (12 Replies)
Discussion started by: srkmish
12 Replies
10. Shell Programming and Scripting
So basically I have a log file and each line in this log file starts with a timestamp:
MON DD HH:MM:SS
SEP 15 07:30:01
I need to grep all the lines between last hour timestamp and current timestamp. Then these lines will be moved to a tmp file from which I will grep for particular strings. ... (1 Reply)
Discussion started by: nms
1 Replies
FIND(1) General Commands Manual FIND(1)
NAME
find - find files meeting a given condition
SYNOPSIS
find directory expression
EXAMPLES
find / -name a.out -print
# Print all a.out paths
find /usr/ast ! -newer f -ok rm {} ;
# Ask before removing
find /usr -size +20 -exec mv {} /big ;
# move files > 20 blks
find / -name a.out -o -name '*.o' -exec rm {};
# 2 conds
DESCRIPTION
Find descends the file tree starting at the given directory checking each file in that directory and its subdirectories against a predi-
cate. If the predicate is true, an action is taken. The predicates may be connected by -a (Boolean and), -o (Boolean or) and ! (Boolean
negation). Each predicate is true under the conditions specified below. The integer n may also be +n to mean any value greater than n, -n
to mean any value less than n, or just n for exactly n.
-name s true if current filename is s (include shell wild cards)
-size n true if file size is n blocks
-inum n true if the current file's i-node number is n
-mtime ntrue if modification time relative to today (in days) is n
-links ntrue if the number of links to the file is n
-newer ftrue if the file is newer than f
-perm n true if the file's permission bits = n (n is in octal)
-user u true if the uid = u (a numerical value, not a login name)
-group gtrue if the gid = g (a numerical value, not a group name)
-type x where x is bcdfug (block, char, dir, regular file, setuid, setgid)
-xdev do not cross devices to search mounted file systems
Following the expression can be one of the following, telling what to do when a file is found:
-print print the file name on standard output
-exec execute a MINIX command, {} stands for the file name
-ok prompts before executing the command
SEE ALSO
test(1), xargs(1).
FIND(1)