Sponsored Content
Top Forums UNIX for Dummies Questions & Answers String extraction from log file Post 302900728 by Dip on Thursday 8th of May 2014 11:50:21 AM
Old 05-08-2014
String extraction from log file

Hi,

Log file will contain text like below:

Code:
May 7 14:12:09 nap_fujitsu-nexus_pbb-denek-01-r_DE.de.ignite.net 108767: 115673: May 7 14:12:08: %RTT-3-IPSLATHRESHOLD: IP SLA Monitor(112): Threshold below for rtt
May 8 14:12:09 nap_fujitsu-nexus_pbb-denek-01-r_DE.de.ignite.net 108767: 115673: May 7 14:12:08: %RTT-3-IPSLATHRESHOLD: IP SLA Monitor(112): Threshold below for rtt
May 9 14:12:09 nap_fujitsu-nexus_pbb-denek-01-r_DE.de.ignite.net 108767: 115673: May 7 14:12:08: %RTT-3-IPSLATHRESHOLD: IP SLA Monitor(112): Threshold below for rtt
May 10 14:12:09 nap_fujitsu-nexus_pbb-denek-01-r_DE.de.ignite.net 108767: 115673: May 7 14:12:08: %RTT-3-IPSLATHRESHOLD: IP SLA Monitor(112): Threshold below for rtt

I need to extract the number "IP SLA Monitor(112):" between this text. So here the command should return "112".

Could you please help me with the command?

Last edited by vgersh99; 05-08-2014 at 12:56 PM.. Reason: code tags, please!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

String extraction from user input - sh

Hi, I have a shell script to build components of a product. The follow snippet will explain what I am doing. # !/bin/sh for choice in "$@" ; do case $choice in "o") echo "Calling $choice" ; o ;; "i") echo... (8 Replies)
Discussion started by: vino
8 Replies

2. Shell Programming and Scripting

Extraction of string from Stringlist using delimiter

Hi Experts, I need to extract some set of strings one be one using delimiter. Example: shellscript.sh|unix.sh|script_file.sh i need to extract this shellscript.sh,unix.sh,script_file.sh separately. I tried but couldn't get. Please help me.. Thanks & Regards :), Kanda (3 Replies)
Discussion started by: spkandy
3 Replies

3. Shell Programming and Scripting

nasty string extraction problem

Hello, if I have a file containing a chunk of HTML and I want to extract always the string beginning http://www.xxx.com/v/ that ends just before "> (i.e. and including the bit BqqtJpfZElQ&hl will change randomly) Any ideas??? # cat randomfeature.html <object width="160"... (3 Replies)
Discussion started by: kevinyeandel1
3 Replies

4. Shell Programming and Scripting

Extraction of the output from a string.

Hi Everyone, I stored the result of a certain awk script in the variable arr.The result is /inets /banking /tools. arr= /inets /banking /tools These are 3 direcctories. I should be able to move in to these directories using "cd" command.Can you tell me how to extract... (5 Replies)
Discussion started by: saicharantej
5 Replies

5. UNIX for Dummies Questions & Answers

String extraction from a text file

The following script code works great for extracting 'postmaster' from a line of text stored in a variable named string: string="PenaltyError:=554 5.7.1 Error, send your mail to postmaster@LOCALDOMAIN" stuff=$( echo $string | cut -d@ -f1 | awk '{ print $NF }' ) echo $stuff However, I need to be... (9 Replies)
Discussion started by: cleanden
9 Replies

6. Shell Programming and Scripting

Need help in string extraction using regular expressions

Hi, I am a new bee to this forum. I am trying to extract the text after a matching pattern from a url using regular expression. Ex: http://locatlhost:2020/proxy/checkthisout I want to extract the string after proxy/. I am not familiar with reg ex. Can someone please help? (2 Replies)
Discussion started by: akatraga
2 Replies

7. Shell Programming and Scripting

String Extraction in Perl

I have a string stored in a variable. For instance, $str = " Opcode called is : CM_OP_xxx " where xxx changes dynamically and can be either LOGIN or SEARCH..... depends on runtime. For example : $str = " Opcode called is : CM_OP_SEARCH " $str = " Opcode called is : CM_OP_LOGIN " I... (3 Replies)
Discussion started by: vkca
3 Replies

8. Shell Programming and Scripting

Sub-string extraction on arrays

Hi, I'm trying to extract the middle of an array that is of variable length but always has a first and last common element, The following works OK... #!/bin/bash ARRAY='switch' ARRAY='option1' ARRAY='option2' ARRAY='option3' ARRAY='value' SWITCH=${ARRAY:0:1} VALUE=${ARRAY:(-1)}... (1 Reply)
Discussion started by: ASGR
1 Replies

9. Solaris

string extraction won't work. Why?

#!/usr/bin/ksh set -x testfile=my.test.file.flag echo ${testfile: (-4)} #/home/maldohe/scripts/spawn1& sleep 3 echo myspawn is now ending exit Background: I am trying to extract the word flag from anf given file name. This is a demo script that I am working on to fix a production issue.... (8 Replies)
Discussion started by: Harleyrci
8 Replies

10. Shell Programming and Scripting

String Extraction

I am trying to extract a time from the below string in perl but not able to get the time properly I just want to extract the time from the above line I am using the below syntax x=~ /(.*) (\d+)\:(\d+)\:(\d+),(.*)\.com/ $time = $2 . ':' . $3 . ':' . $4; print $time Can... (1 Reply)
Discussion started by: karan8810
1 Replies
ppmtosixel(1)						      General Commands Manual						     ppmtosixel(1)

NAME
ppmtosixel - convert a portable pixmap into DEC sixel format SYNOPSIS
ppmtosixel [-raw] [-margin] [ppmfile] DESCRIPTION
Reads a portable pixmap as input. Produces sixel commands (SIX) as output. The output is formatted for color printing, e.g. for a DEC LJ250 color inkjet printer. If RGB values from the PPM file do not have maxval=100, the RGB values are rescaled. A printer control header and a color assignment table begin the SIX file. Image data is written in a compressed format by default. A printer control footer ends the image file. OPTIONS
-raw If specified, each pixel will be explicitly described in the image file. If -raw is not specified, output will default to com- pressed format in which identical adjacent pixels are replaced by "repeat pixel" commands. A raw file is often an order of magni- tude larger than a compressed file and prints much slower. -margin If -margin is not specified, the image will be start at the left margin (of the window, paper, or whatever). If -margin is speci- fied, a 1.5 inch left margin will offset the image. PRINTING
Generally, sixel files must reach the printer unfiltered. Use the lpr -x option or cat filename > /dev/tty0?. BUGS
Upon rescaling, truncation of the least significant bits of RGB values may result in poor color conversion. If the original PPM maxval was greater than 100, rescaling also reduces the image depth. While the actual RGB values from the ppm file are more or less retained, the color palette of the LJ250 may not match the colors on your screen. This seems to be a printer limitation. SEE ALSO
ppm(5) AUTHOR
Copyright (C) 1991 by Rick Vinci. 26 April 1991 ppmtosixel(1)
All times are GMT -4. The time now is 10:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy