Sponsored Content
Operating Systems HP-UX Comparing the timestamp of the file to current time Post 302938923 by RavinderSingh13 on Friday 20th of March 2015 05:09:42 AM
Old 03-20-2015
Hello Haadiya,

Following may help you in same.
Code:
VAL=`find -type f -mmin +120 -iname "Input_file"`
if [[ -n $VAL ]]
then
       echo "File is OLDER than 2 hours."
else
       echo "File is NOT older than 2 hours."
fi

I have just provided and example for same in if else statements you can provide actions too which you want to perform, hope this helps.

Thanks,
R. Singh
This User Gave Thanks to RavinderSingh13 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How can I create a file with current time - 60 minutes

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

comparing timestamp of a file with its touched version

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

Reading Hours and Minutes from file and comparing with current

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

how to grep and compare timestamp in a file with the current date

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

how to grep and compare timestamp in a file with the current date

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

Compare file timestamp with current date. Diff must be 1 hour.

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

Compare current time to timestamp on a file

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

Based on the first & last timestamp of the file, need to calculate the time taken to complete

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

To check timestamp in logfile and display lines upto 3 hours before current timestamp

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

Grep lines between last hour timestamp and current timestamp

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
Net::SIP::Packet(3pm)					User Contributed Perl Documentation				     Net::SIP::Packet(3pm)

NAME
Net::SIP::Packet - handling of SIP packets SYNOPSIS
use Net::SIP::Packet; my $pkt = eval { Net::SIP::Packet->new( $sip_string ) } or die "invalid SIP packet"; $pkt->get_header( 'call-id' ) || die "no call-id"; $pkt->set_header( via => @via ); print $pkt->as_string; DESCRIPTION
This module implements the parsing, manipulation and creation of SIP packets according to RFC3261. NET::SIP::Packet's objects can be created by parsing a string containing the SIP packet or by constructing it from parts, e.g. header keys and values, body, method+URI (requests) or code+text (responses). All parts can be manipulated and finally the string representation of the manipulated packet can be (re)created. For dealing with requests and responses directly usually the subclasses Net::SIP::Request or Net::SIP::Response will be used instead. EXAMPLES
# create packet from string my $invite = Net::SIP::Packet->new( <<'EOS' ); INVITE sip:you@example.com SIP/2.0 From: <sip:me@example.com> To: <sip:you@example.com> ... EOS # show and manipulate some header print "callid=".$invite->get_header( 'call-id' )." "; print "route=".join( ",", $invite->get_header( 'route' ))." "; $invite->set_header( 'via' => [ $via1,$via2,.. ] ); # get resulting string representation print $invite->as_string; # create packet from parts my $resp = Net::SIP::Packet->new( 200, 'Ok', { to => '<sip:you@example.com>', from => '<sip:me@example.com>',.. } Net::SIP::SDP->new(...) ); # and get the packet as string print $resp->as_string; CONSTRUCTOR
new ( STRING | @PARTS ) This is the default constructor. Depending on the number of arguments branches into new_from_string or new_from_parts. new_from_string ( STRING ) Interprets STRING as a SIP request or response and creates Net::SIP::Request or Net::SIP::Response object accordingly. Will die() if it cannot parse the string as a SIP packet. new_from_parts ( CODE|METHOD, TEXT|URI, \%HEADER|@HEADER, [ BODY ] ) If CODE|METHOD is numeric a Net::SIP::Response object will be created with the response code CODE and the text TEXT. Otherwise a Net::SIP::Request object will be created with the method METHOD and the uri URI. Header data can be given as a hash %HEADER or array @HEADER reference. In case of a hash the key is the SIP field name and the value as either a string or a @list of strings. The fields on the resulting SIP packet will be sorted by name of the fields and fields with multiple values will be created as seperat lines. If the header is given as an array the elements of the array are "[ key => value ]" pairs where the keys are the field names and the values are strings or @list of strings. Each pair will result in a single line in the SIP header. If the value was a list reference the values in the list will be concatened by ','. The order of the fields in the resulting SIP packet will be the same as in the array. The BODY is optional and can be given either as a string or as an reference to an object which has a method as_string, like Net::SIP::SDP. If the BODY is an object which has a method content_type it will set the "content-type" header of the SIP object based on the result of "BODY->content_type" unless a "content-type" header was explicitly given. METHODS
is_request Returns TRUE if the SIP packet is a request, otherwise FALSE. is_response Returns TRUE if the SIP packet is a response, otherwise FALSE. tid Returns a transaction ID created from the sequence number in the "CSeq" header and the "Call-Id" header. All packets with the same tid belong to the same transaction. cseq Returns "CSeq" header. Short for "$self->get_header( 'cseq' )". callid Returns "Call-Id" header. Short for "$self->get_header( 'call-id' )". get_header ( [ NAME ] ) If NAME is given it returns the SIP header for NAME. If no header exists returns (). If there is only one value for the header returns this value. In case of multiple values it returns a @list of all values, but if "wantarray" says, that the caller expects only a single value it will "croak()". If no NAME is given it will return a reference to a hash wich contains all fields and has the format described in new_from_parts. add_header ( NAME, VAL ) Adds the header at the end of the SIP header. VAL can be a string or a reference to a list of strings. insert_header ( NAME, VAL ) Like add_header, but the lines will be added on top of the header. del_header ( NAME ) Delete all lines from header where the field name is NAME. set_header ( NAME, VAL ) Replaces an existing header, like del_header followed by add_header. set_body ( VAL ) Sets body to VAL, which can be string or object. The handling for body objects see new_from_parts. as_string Returns string representation of SIP packet. dump ( [ LEVEL ] ) Returns dump of packet as string for debugging. The higher LEVEL is the more details one gets. At the moment a LEVEL of 0 gets a one- line summary and the rest the result from as_string. as_parts Returns Array with CODE|METHOD, TEXT|URI, @HEADER and BODY like used in new_from_parts. sdp_body Returns body as Net::SIP::SDP object if there is a body and the content-type is 'application/sdp' or empty. If body contains invalid SDP it raises an exception (e.g. die()). UNDOCUMENTED METHODS get_header_hashval ( [ NAME ] ) scan_header ( @ARG ) clone perl v5.14.2 2011-08-26 Net::SIP::Packet(3pm)
All times are GMT -4. The time now is 01:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy