Sponsored Content
Full Discussion: Extract a value from log
Top Forums Shell Programming and Scripting Extract a value from log Post 302533884 by ctsgnb on Saturday 25th of June 2011 08:47:56 AM
Old 06-25-2011
With the same example file as above :

Code:
$ awk -F: '{++x;s+=$NF;print $NF}END{print "average=" s/x}' logfile
0.265
0.857
0.376
average=0.499333

---------- Post updated at 02:47 PM ---------- Previous update was at 02:43 PM ----------

I need to know how your logfile looks like .

Does it only contain lines that ends with a string "request:<value>" ?

If not then please post a representative example of how does your logfile look like (with all the lines, not only those that have the "resquest:<value>", so we can then be more accurate in the line selection before extracting the value and calculating the average
This User Gave Thanks to ctsgnb For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extract a portion of log file

hello, I want to grep the log file according to time and get the portion of log from one particular time to other. I can grep for individual lines by time but how should I print lines continuously from given start time till end till given end time. Appreciate your ideas, Thanks chandra (8 Replies)
Discussion started by: chandra004
8 Replies

2. AIX

need to extract info from log files

hi guys i need to extract information from log files generated by an application. log file has the following lines for each process.. ---------------------------------------------- Fri Aug 03 12:06:43 WST 2007 INFO: Running project PROJECT1 Fri Aug 03 12:06:43 WST 2007 INFO: Source Files... (7 Replies)
Discussion started by: kirantalla
7 Replies

3. Shell Programming and Scripting

Help: Log data extract

So I got this old webapp doing some strange format with its logging and I need to extract only specific parts. Basically the format of the log goes: Date:<space>timestamp User:<space>userid AppID:<space>applicationid Duration:<space>time(ms) <line> <line> Date:<space>timestamp... (1 Reply)
Discussion started by: kenm0j0
1 Replies

4. Shell Programming and Scripting

How to extract last week data from a log

HI, I have a log file (sync.log) in the following format. 05-14 05:34:56 INFO Hxxx Start: Id:xxx 05-14 05:45:32 INFO Hxxx End: Id:xxxx 05-19 11:23:21 INFO Hxxx Start: Id:xxx 05-19 11:34:45 INFO Hxxx End: Id:xxxx 05-20 02:09:47 INFO Hxxx Start: Id:xxx 05-20 02:36:03 INFO Hxxx End: Id:xxx... (5 Replies)
Discussion started by: praveenvi
5 Replies

5. Shell Programming and Scripting

How to extract certain part of log file?

Hi there, I'm having some problem with UNIX scripting (ksh), perhaps somebody can help me out? For example: ------------ Sample content of my log file (text file): -------------------------------------- File1: .... info_1 ... info_2 ... info_3 ... File2: .... info_1 ... info_2 ...... (10 Replies)
Discussion started by: superHonda123
10 Replies

6. Shell Programming and Scripting

Extract various information from a log file

Hye ShamRock If you can help me with this difficult task for me then it will save my day Logs : ================================================================================================================== ... (4 Replies)
Discussion started by: SilvesterJ
4 Replies

7. Shell Programming and Scripting

Extract all ERROR's on LOG File

Hello, As I am still in trouble to easly extract all error's by date in log file, I am deply requesting your help ... Here is an example of one error (the log file may contain a huge amont of error's, I must be able to extract all error for a day in parameter): ***** L1 FILE... (4 Replies)
Discussion started by: Aswex
4 Replies

8. Shell Programming and Scripting

Extract IP Address from Log File

I have a log file with several IP addresses in it:- 2012-12-06 16:05:05,885 NOTICE **SNMP** Alarm was created: (LicenseClientRejected) Client Remote Peer /125.111.64.125:2573 was Rejected Property=/125.111.64.125:2573, Client Remote Peer /125.111.64.125:2573 was Rejected **SNMP**.... (5 Replies)
Discussion started by: BHM
5 Replies

9. UNIX for Dummies Questions & Answers

Extract Numbers from a log file

Hi, I am trying to grep/extract the number list from this log file, can I get some help on this. I can grep the word 'href' to see the numbers, but it is resulting with the complete line. Content of my file: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <html> <head>... (4 Replies)
Discussion started by: Sajjadmehdi
4 Replies

10. Shell Programming and Scripting

Extract data from log

I have logs in format ####<01-Mar-2015 03:48:18 o'clock GMT> <info> ####<01-Mar-2015 03:48:20 o'clock GMT> <info> ####<01-Mar-2015 03:48:30 o'clock GMT> <info> ####<01-Mar-2015 03:48:39 o'clock GMT> <info> I am looking out for a script which can extract data of last 15 minutes from the... (5 Replies)
Discussion started by: oberoi1403
5 Replies
jfs_fscklog(8)						   Extract/Display JFS fsck Log 					    jfs_fscklog(8)

NAME
jfs_fscklog - extract a JFS fsck service log into a file and/or format and display the extracted file SYNOPSIS
jfs_fscklog [ -d ] [ -e device ] [ -f output.file ] [ -p ] [ -V ] DESCRIPTION
jfs_fscklog with option -e device extracts the contents of either the most recent or immediately prior (specified with option -p) JFS fsck service log from the specified device, and writes the output to a file. The file name may be specified with the -f option, or the default file name is <pwd>fscklog.new. If the -p option is used, the default file name is <pwd>fscklog.old. jfs_fscklog with option -d formats and displays the contents of the extracted file. jfs_fscklog with options -d and -e device extracts and displays the JFS fsck service log. OPTIONS
-d Format and display a previously extracted JFS fsck service log. -e device Extract the JFS fsck service log from device and store it in a file. (device is the special file name corresponding to the actual device from which the fsck log will be extracted (e.g. /dev/hdb1 )). -f file.name Specify the file name, overriding the default file name. When used with -e device, file.name specifies the name of the file into which the JFS fsck log will be extracted. When used with -d, file.name specifies the name of the extracted file whose contents will be formatted and displayed. file.name must be 127 characters or less in length. file.name will be created in the present working directory unless it is fully qualified. -p Extract the prior log (as opposed to the most recent log). -V Print version information and exit (regardless of any other chosen options). EXAMPLES
Extract the most recent JFS fsck log on /dev/hda5 into <pwd>fscklog.new: jfs_fscklog -e /dev/hda5 Extract the most recent JFS fsck log on /dev/hdb3 into /temp/l9651107.log: jfs_fscklog -e /dev/hdb3 -f /temp/l9651107.log Display the JFS fsck log that was extracted into /temp/l9651107.log: jfs_fscklog -d -f /temp/l9651107.log Extract and display the previous JFS fsck log from /dev/hda8: jfs_fscklog -e /dev/hda8 -d -p REPORTING BUGS
If you find a bug in JFS or jfs_fscklog, please report it via the bug tracking system ("Report Bugs" section) of the JFS project web site: http://jfs.sourceforge.net/ Please send as much pertinent information as possible, including any jfs_fscklog error messages and the complete output of running jfs_fsck with the -v option on the JFS device. SEE ALSO
jfs_fsck(8), jfs_mkfs(8), jfs_tune(8), jfs_logdump(8), jfs_debugfs(8) AUTHOR
Barry Arndt (barndt@us.ibm.com) jfs_fscklog is maintained by IBM. See the JFS project web site for more details: http://jfs.sourceforge.net/ October 28, 2002 jfs_fscklog(8)
All times are GMT -4. The time now is 05:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy