Sponsored Content
Top Forums Shell Programming and Scripting Parsing log file for last 2 hours Post 302853589 by learnbash on Sunday 15th of September 2013 12:25:04 PM
Old 09-15-2013
I am using Fedora-17 and my shell is bash shell, My log file name i already mention, i don't want anything special.

Code:
Sep 15 01:41:33 servername
Sep 15 01:46:05 servername
Sep 15 02:46:05 servername
Sep 15 02:41:33 servername
Sep 15 02:46:05 servername
Sep 15 03:46:05 servername
Sep 15 03:41:33 servername
Sep 15 03:46:05 servername
Sep 15 04:46:05 servername
Sep 15 04:41:33 servername
Sep 15 04:46:05 servername
Sep 15 04:46:05 servername
Sep 15 05:41:33 servername
Sep 15 05:46:05 servername
Sep 15 05:46:05 servername
Sep 15 05:41:33 servername
Sep 15 06:46:05 servername
Sep 15 06:46:05 servername
Sep 15 06:41:33 servername
Sep 15 06:46:05 servername
Sep 15 07:46:05 servername
Sep 15 07:41:33 servername
Sep 15 07:46:05 servername
Sep 15 08:46:05 servername

I want log of two last hours. So i want last two hours log. Current my time is 08:50 so it show log time of 6 hour and 7 hour. Below is expected output, if i run at 12:10PM so it will show log of 10:00AM and 11:00AM vice versa.

Code:
Sep 15 06:46:05 servername
Sep 15 06:46:05 servername
Sep 15 06:41:33 servername
Sep 15 06:46:05 servername
Sep 15 07:46:05 servername
Sep 15 07:41:33 servername
Sep 15 07:46:05 servername


Last edited by learnbash; 09-15-2013 at 01:26 PM.. Reason: further detail provided
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parsing a Log file

Hi All, I'm deffently not a Unix specialist so be Gentel. I need to parse a Log file that looks like that: 2006-06-12 01:00:00,463 ERROR {cleanLoggersFiles} General Error comverse.compas.shared.exceptions.SystemParametersException: Error in reading parameter FileLocation at... (4 Replies)
Discussion started by: tbirenzweig
4 Replies

2. Shell Programming and Scripting

Help with script parsing a log file

I have a large log file, which I want to first use grep to get the specific lines then send it to awk to print out the specific column and if the result is zero, don't do anything. What I have so far is: LOGDIR=/usr/local/oracle/Transcription/log ERRDIR=/home/edixftp/errors #I want to be... (3 Replies)
Discussion started by: mevasquez
3 Replies

3. Shell Programming and Scripting

Last 24 hours of a log file

I'm looking to pull the last 24 hours of a log file. Here's what I've got so far: yesterday=$(TZ=$TZ+24 date +"%b %e %H:%M") today=$(date +"%b %e %H:%M") echo $yesterday $today grep -E "^$yesterday|^$today" /var/adm/syslog/syslog.log But that pulls everything from $yesterday from... (1 Reply)
Discussion started by: Bert
1 Replies

4. UNIX for Dummies Questions & Answers

Script for parsing details in a log file to a seperate file

Hi Experts, Im a new bee for scripting, I would ned to do the following via linux shell scripting, I have an application which throws a log file, on each action of a particular work with the application, as sson as the action is done, the log file would vanish or stops updating there, the... (2 Replies)
Discussion started by: pingnagan
2 Replies

5. UNIX for Dummies Questions & Answers

parsing a log file

I need help in parsing the following log files. 10 Apr 2009 0:16:16 * name: Tuna Belly Format: Well done, Price: 999 only 10 Apr 2009 0:16:16 * name: Roast Beef Format: Raw, Price: 55 c 10 Apr 2009 0:16:16 * name: Pasta Format: Dry, Price: 88.43 only etcetc I need to parse this... (8 Replies)
Discussion started by: izuma
8 Replies

6. Shell Programming and Scripting

Log file text parsing

I'm new to scripting and was wondering if there was a way to accomplish what I want below using shell script(s). If there is a log file as follows, where the id is the unique id of a process, with the timestamp of when the process began and completed displayed, would it be possible to find the... (3 Replies)
Discussion started by: dizydolly
3 Replies

7. Shell Programming and Scripting

Help Parsing a Log File

Hello all, I am new to scripting and I have written a script that performs an Rsync on my NAS and then moves on to send me an email with the status etc. The problem is that I think Rsync is taking to long to complete and the IF statement is timing out, as it doesn't appear to move on. Here... (1 Reply)
Discussion started by: Mongrel
1 Replies

8. Shell Programming and Scripting

Parsing Log File help

Hi, I am a newbie to scripting. I have multiple log files (saved as .gz) in a directory that looks like this 01-01-2013 10:00 pn: 123 01-01-2013 10:00 sn: 987 01-01-2013 10:00 Test1 01-01-2013 10:00 Result: Pass 01-01-2013 10:00 Time: 5:00 01-01-2013 10:00 Test2 01-01-2013 10:00... (3 Replies)
Discussion started by: linuxnew
3 Replies

9. Shell Programming and Scripting

HELP on parsing this log file

Hi, I have a log file that looks like below and I am wanting to know if there is a better way of parsing it from how I am doing it right now. I am looking for when an application service is OFFLINE and ONLINE. This log file is getting written into every 30 minutes ... (1 Reply)
Discussion started by: newbie_01
1 Replies

10. Shell Programming and Scripting

Help 'speeding' up this 'parsing' script - taking 24+ hours to run

Hi, I've written a ksh script that read a file and parse/filter/format each line. The script runs as expected but it runs for 24+ hours for a file that has 2million lines. And sometimes, the input file has 10million lines which means it can be running for more than 2 days and still not finish.... (9 Replies)
Discussion started by: newbie_01
9 Replies
AuOpenServer(3) 					     Library Functions Manual						   AuOpenServer(3)

Name
       AuOpenServer - connect to audio server

Synopsis
       #include <audio/audiolib.h>

       AuServer *AuOpenServer(servername, num_authproto, authproto, num_authdata, authdata, ret_status)
	   char *servername;
	   int num_authproto;
	   char *authproto;
	   int num_authdata;
	   char *authdata;
	   char **return_status; /* RETURN */

Arguments
       servername
		 Specifies the audio server name.  This determines the server and communications domain to be used.

       num_authproto
		 Specifies the length of the connection authorization protocol name.

       authproto Specifies the name of the connection authorization protocol.

       num_authdata
		 Specifies the length of the connection authorization data.

       authdata  Specifies the connection authorization data.

       return_status
		 If non-NULL, and the connection is refused, returns an error message.

Description
       AuOpenServer  creates a connection to the specified audio server and returns a pointer to an AuServer structure or NULL, with return_status
       (if non-NULL) pointing to an error message describing the reason, if it was unsuccessfull.

       If servername is NULL or a pointer to NUL, AuOpenServer get the value from the enviroment.  servername  has  the  format  hostname:port	or
       hostname::port.	 If  a	double colon (::) separates the hostname and port number, AuOpenServer connects using DECnet streams.  If a single
       colon (:) separates the hostname and port number, and the hostname is a host machine name, AuOpenServer connects using TCP streams.   If  a
       single  colon  (:)  separates the hostname and port number, and the hostname is "unix", AuOpenServer connects using UNIX domain sockets (or
       Streams).  If the hostname is not specified, AuOpenServer uses whatever it believes is the fastest transport.

See Also
       AuCloseServer, AuServerName.

       audiolib - Network Audio System C Language Interface

audiolib - housekeeping 					       1.9.3							   AuOpenServer(3)
All times are GMT -4. The time now is 05:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy