Sponsored Content
Top Forums Shell Programming and Scripting Taking a specific value from a log file Post 302780895 by Lord Spectre on Friday 15th of March 2013 09:15:59 AM
Old 03-15-2013
Taking a specific value from a log file

Dear community,
I've a file contaning some logs like:
Code:
185413.854: [GC 3938735K->3100312K(4089472K), 0.0124750 secs]
185456.748: [GC 3897187K(4089472K), 0.5681710 secs]
185457.631: [GC 3940519K->3101353K(4089472K), 0.0107800 secs]
185467.213: [GC 3873521K(4089472K), 1.1164290 secs]
185468.913: [GC 3940265K->3102224K(4089472K), 0.0114570 secs]
185472.378: [GC 3369975K(4089472K), 0.4640150 secs]
185479.944: [GC 3940134K->3101807K(4089472K), 0.0154030 secs]
185482.828: [GC 3338284K(4089472K), 0.0680050 secs]
185486.855: [GC 3660673K(4089472K), 0.9342110 secs]
185490.946: [GC 3940426K->3101326K(4089472K), 0.0120510 secs]
185497.580: [GC 3649545K(4089472K), 0.7692390 secs]
185501.771: [GC 3940088K->3101499K(4089472K), 0.0123540 secs]
185501.787: [GC 3101727K(4089472K), 0.0061810 secs]
185511.343: [GC 3851751K(4089472K), 1.1011740 secs]
185513.458: [GC 3940411K->3101902K(4089472K), 0.0117240 secs]
185501.787: [GC 3101727K(4089472K), 0.0061810 secs]
185516.603: [GC 3361385K(4089472K), 0.4643180 secs]

What I need to do is extract the value in red/bold from the last line with "->". I tried:
Code:
# tail gclog.txt | grep "-" | awk -F"[>K]" '/->/{print $3}'
3101807
3101326
3101499
3101902

But I need only 3101902

Hope is clear, thanks.
Lucas
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

read specific text from a log file

Hi guys I need to retrieve the values in BOLD that I have mentioned in the below log file. I want to store those values in a variable, preferably the same name as the column name in the log file. if you paste the below mentioned log file in a notepad and remove the word wrap.. u will get a... (4 Replies)
Discussion started by: ragha81
4 Replies

2. Shell Programming and Scripting

How to read a specific value from a Log file?

Hi, I have a .log file in which it has many values. But i need some specific values. How it can be done using Shell Script. Please explain in detail. Thankx in advance. Sathish D V. (8 Replies)
Discussion started by: cooolthud
8 Replies

3. Shell Programming and Scripting

Extract Specific pattern - log file

Hello everyone, I am on AIX (6.1). I can only use shell (ksh) script. I can't do this on my own, so will do my best to explain my needs.I also do not know what is the best idea to make it work, so here is what I am thinking, but I may wrong. I need help to extract info on... (3 Replies)
Discussion started by: Aswex
3 Replies

4. Shell Programming and Scripting

Write out specific data from log to a new file

I got a huge log in zipped files, i need to write out lines by specific data and if the line with the same contains XML message with the same sessionID will be written to the file to. The log structure: 2013-08-16 16:31:06,810 ( 122: rogate) INFO - UId:10453, GId:5422: new... (16 Replies)
Discussion started by: batka
16 Replies

5. UNIX for Dummies Questions & Answers

Search for a specific String in a log file for a specific date range

Hi, I have log file which rolls out every second which is as this. HttpGenRequest - -<!--OXi dbPublish--> <created="2014-03-24 23:45:37" lastMsgId="" requestTime="0.0333"> <response request="getOutcomeDetails" code="114" message="Request found no matching data" debug="" provider="undefined"/>... (3 Replies)
Discussion started by: karthikprakash
3 Replies

6. Shell Programming and Scripting

Need specific columns in a log file as excel.

Hi All... I am in need of few columns from a log file.. in .xls file... below is what i have tried. my log file has 16 colums with " ; " as delimiter, but i need randomn columns 1 2 3 4 5 6 10 11 16 in an excel. I tried to awk the columns with delimiter ; and it worked, below is the log... (5 Replies)
Discussion started by: nanz143
5 Replies

7. Shell Programming and Scripting

Check specific content from log file

Hi all, i have a logfile which is continuously being updated. I have built a script to check for a specific content and if it is found, it sends a string into a file. Here's the current script: #!/bin/bash logfile=/opt/jboss-eap-6.3/standalone/log/server.log tail -fn0 $logfile | \... (7 Replies)
Discussion started by: nms
7 Replies

8. UNIX for Beginners Questions & Answers

Viewing a specific timeframe of a log file

Hi guys Done a bit of research online but can't seem to figure it out, is there anyway of grepping or using sed to view a specific time period of a log file. I am trying to view a log file for Saturday 22nd April between 08:00 - 12:00 I saw this command online and tried but doesn't seem to... (10 Replies)
Discussion started by: simpsa27
10 Replies

9. UNIX for Beginners Questions & Answers

Selecting specific variable in log file

Hi there I am trying to look for a specific word in the log file and I am aware this can be done by grep for example. As there will be multiple entries for this I want to grep the last one to enter the log... how would I go about this - would I have to use tail? Thanks in advance Alex (4 Replies)
Discussion started by: simpsa27
4 Replies

10. Shell Programming and Scripting

Grep a log file starting from a specific time to the end of file

I have a log file which have a date and time at the start of every line. I need to search the log file starting from a specific time to the end of file. For example: Starting point: July 29 2018 21:00:00 End point : end of file My concern is what if the pattern of `July 29 2018 21:00:00`... (3 Replies)
Discussion started by: erin00
3 Replies
volcheck(1)                                                        User Commands                                                       volcheck(1)

NAME
volcheck - checks for media in a drive and by default checks all floppy media SYNOPSIS
volcheck [-v] [-i secs] [-t secs] pathname DESCRIPTION
The volcheck utility tells Volume Management to look at each dev/pathname in sequence and determine if new media has been inserted in the drive. The default action is to volcheck all checkable media managed by volume management. OPTIONS
The following options are supported: -i secs Set the frequency of device checking to secs seconds. The default is 2 seconds. The minimum frequency is 1 second. -t secs Check the named device(s) for the next secs seconds. The maximum number of seconds allowed is 28800, which is 8 hours. The fre- quency of checking is specified by -i. There is no default total time. -v Verbose. OPERANDS
The following operands are supported: pathname The path name of a media device. EXAMPLES
Example 1: A sample of the volcheck command. The following example example% volcheck -v /dev/diskette /dev/diskette has media asks Volume Management to examine the floppy drive for new media. The following example example% volcheck -i 2 -t 600 /dev/diskette1 & asks Volume Management if there is a floppy in the floppy drive every 2 seconds for 600 seconds (10 minutes). FILES
/dev/volctl Volume Management control port ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWvolu | +-----------------------------+-----------------------------+ SEE ALSO
eject(1), volcancel(1), volmissing(1) rmmount(1M), vold(1M), rmmount.conf(4), vold.conf(4), attributes(5), volfs(7FS) WARNINGS
Due to a hardware limitation in many floppy drives, the act of checking for media causes mechanical action in the floppy drive. Continu- ous polling of the floppy drive will cause the drive to wear out. It is recommended that polling the drive only be performed during periods of high use. SunOS 5.10 21 Feb 1997 volcheck(1)
All times are GMT -4. The time now is 02:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy