Sponsored Content
Full Discussion: Simple awk
Top Forums Shell Programming and Scripting Simple awk Post 302838445 by liv2luv on Monday 29th of July 2013 05:14:44 PM
Old 07-29-2013
Code:
$ cat show-log.sh
#!/bin/ksh
## This script is to view the wanted values in EnginePerformance Log for both Request and Response logs from message broker.
FILENAME="EnginePerformance.log"

## Check if the file exist
if [ -e $FILENAME ];
  then ""
else
  echo "$FILENAME does not exist!"
  exit 1
fi

## Tail the file and parse request and response logs
tail -1000f $FILENAME | awk -F '|' '/RPALBKL/||/RPBLBKL/||/RPCLBKL/{
if($3~/\.Request/)
   print $3 $4 $11 $12 $22 $23 $24 $25 $26 $27;
else if($3~/\.Response/)
   print $3 $4 $6 $19 $20 $21 $22 $23 }
'
exit 0

The code is same across all servers. Also the servers are cloned from a single image. It is indeed surprising to see the in-consistent behavior. Any hint will be helpful. Thanks.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with a simple script using awk

I need a hand with this simple script, in Unix i have a variable called portal: $ echo $portal chu0 when i use awk this variable is not recognized. How can i make awk recognize and print the value of this variable, since the output is not shown i.e. awk ' BEGIN {printf("%4s\t%14s\n",... (3 Replies)
Discussion started by: alexcol
3 Replies

2. Shell Programming and Scripting

simple awk

when I execute this awk stmt .. awk "/log_directory/ { print $5}" /opt/dba/oraadmin/tools/tmp_purge_op.log it's returning the whole line as .. IRMD118_LISTENER1 parameter "log_directory" set to /opt/oracle/10.2/network/log/ my expected output is : /opt/oracle/10.2/network/log what... (7 Replies)
Discussion started by: talashil
7 Replies

3. Shell Programming and Scripting

simple awk help

Whats the syntax to find all lines that matches a text and print out specific fields after the match? ex: 1: some random text 2: Full name: John E. Smith 3: some random text 4: Full name: Mary J. Lue 5: some random text So I'd like to print out First names or last names or everything... (2 Replies)
Discussion started by: linuxdude
2 Replies

4. Shell Programming and Scripting

help with simple awk script

Hi, I just don't understand awk. I think I'm close here but can someone give me a hand to finish this little parsing routine ? the input file is formatted like this: District 2502110 Gsub 2384889 Gsub 1428180 District 2502220 Gsub 1466390 Gsub 1466389 Gsub 1466388 Gsub 1466386 Gsub... (4 Replies)
Discussion started by: fwellers
4 Replies

5. UNIX for Dummies Questions & Answers

Please explain this simple AWK example

awk '!_++' Most importantly, I want to know what the underscore does "!_" But ideally, please breakdown the whole thing. It is supposed to remove duplicate lines when found in a file. (1 Reply)
Discussion started by: glev2005
1 Replies

6. Shell Programming and Scripting

Simple awk problem II

Hello; Trying to figure out how to keep just the contents between the two search lines: awk '/regexp_1/ ,/regexp_2/' I do not want lines containing regexp_1 and regexp_2 in the output. Thank you for any ideas Video tutorial on how to use code tags in The UNIX and Linux Forums. (5 Replies)
Discussion started by: delphys
5 Replies

7. Shell Programming and Scripting

another simple awk problem

Hello; I need to print two previous lines after searching for a reg exp: awk '/haywood/' should produce the following =================== p9J46THe020804 89922 Tue Oct 18 21:06 MAILER-DAEMON (host map: lookup (haywood.com): deferred) ... (1 Reply)
Discussion started by: delphys
1 Replies

8. Shell Programming and Scripting

Need help with simple comparison in AWK

Hi, I'm new to AWK and I'm having problems comparing a field to a string variable. /ARTIST/ {x = $2} $1 ~ x {print $0}My code tries to find a record with the string "ARTIST". Once it finds it, it stores the second field of the record into a variable. I don't know what the problem is for the... (7 Replies)
Discussion started by: klusps
7 Replies

9. Shell Programming and Scripting

Simple awk use

Hi, I have a file such that: 40454,31,48,4,1304.967741935484,1 31708,25,48,4,1268.32,1 20900,64501,671,788,0.3240259840932699,0 20137,51358,834,743,0.3920908135051988,0 I want to replace the 6th column by "ones" if it is 1, and with "zeros" if it is 0. Thanks. (6 Replies)
Discussion started by: shekhar2010us
6 Replies

10. Shell Programming and Scripting

Simple awk help

Hey all, so I'm using AWK in a project at work, to generate xml from csv. So far things are going relatively smoothly, but I have one thing I can't figure out. For every field in each row, I must generate <entry name=KWNamex>Field</entry> Then I will need to pull data from a second file... (6 Replies)
Discussion started by: Parrakarry
6 Replies
Log::Report::Dispatcher::File(3pm)			User Contributed Perl Documentation			Log::Report::Dispatcher::File(3pm)

NAME
Log::Report::Dispatcher::File - send messages to a file or file-handle INHERITANCE
Log::Report::Dispatcher::File is a Log::Report::Dispatcher SYNOPSIS
dispatcher Log::Report::Dispatcher::File => 'stderr' , to => *STDERR, accept => 'NOTICE-'; # close a dispatcher dispatcher close => 'stderr'; # let dispatcher open and close the file dispatcher FILE => 'mylog', to => '/var/log/mylog' , charset => 'utf-8'; ... dispatcher close => 'mylog'; # will close file # open yourself, then also close yourself open OUT, ">:encoding('iso-8859-1')", '/var/log/mylog' or fault "..."; dispatcher FILE => 'mylog', to => *OUT; ... dispatcher close => 'mylog'; close OUT; # dispatch into a scalar my $output = ''; open $outfile, '>', $output; dispatcher FILE => 'into-scalar', to => $outfile; ... dispatcher close => 'into-scalar'; print $output; DESCRIPTION
This basic file logger accepts an file-handle or filename as destination. METHODS
Constructors $obj->close Only when initiated with a FILENAME, the file will be closed. In any other case, nothing will be done. Log::Report::Dispatcher::File->new(TYPE, NAME, OPTIONS) -Option --Defined in --Default accept Log::Report::Dispatcher depend on mode charset Log::Report::Dispatcher LOCALE format_reason Log::Report::Dispatcher 'LOWERCASE' locale Log::Report::Dispatcher <system locale> mode Log::Report::Dispatcher 'NORMAL' replace false to <required> accept => REASONS charset => CHARSET format_reason => 'UPPERCASE'|'LOWERCASE'|'UCFIRST'|'IGNORE'|CODE locale => LOCALE mode => 'NORMAL'|'VERBOSE'|'ASSERT'|'DEBUG'|0..3 replace => BOOLEAN Only used in combination with a FILENAME: throw away the old file if it exists. Probably you wish to append to existing information. Use the LOCALE setting by default, which is LC_CTYPE or LC_ALL or LANG (in that order). If these contain a character-set which Perl understands, then that is used, otherwise silently ignored. to => FILENAME|FILEHANDLE|OBJECT You can either specify a FILENAME, which is opened in append mode with autoflush on. Or pass any kind of FILE-HANDLE or some OBJECT which implements a "print()" method. You probably want to have autoflush enabled on your FILE-HANDLES. When cleaning-up the dispatcher, the file will only be closed in case of a FILENAME. Accessors $obj->filename Returns the name of the opened file, or "undef" in case this dispatcher was started from a file-handle or file-object. $obj->isDisabled See "Accessors" in Log::Report::Dispatcher $obj->mode See "Accessors" in Log::Report::Dispatcher $obj->name See "Accessors" in Log::Report::Dispatcher $obj->needs See "Accessors" in Log::Report::Dispatcher $obj->type See "Accessors" in Log::Report::Dispatcher Logging $obj->collectLocation Log::Report::Dispatcher::File->collectLocation See "Logging" in Log::Report::Dispatcher $obj->collectStack([MAXDEPTH]) Log::Report::Dispatcher::File->collectStack([MAXDEPTH]) See "Logging" in Log::Report::Dispatcher $obj->log(HASH-of-OPTIONS, REASON, MESSAGE) See "Logging" in Log::Report::Dispatcher $obj->stackTraceLine(OPTIONS) Log::Report::Dispatcher::File->stackTraceLine(OPTIONS) See "Logging" in Log::Report::Dispatcher $obj->translate(HASH-of-OPTIONS, REASON, MESSAGE) See "Logging" in Log::Report::Dispatcher SEE ALSO
This module is part of Log-Report distribution version 0.94, built on August 23, 2011. Website: http://perl.overmeer.net/log-report/ LICENSE
Copyrights 2007-2011 by Mark Overmeer. For other contributors see ChangeLog. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html perl v5.14.2 2011-08-23 Log::Report::Dispatcher::File(3pm)
All times are GMT -4. The time now is 12:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy