Sponsored Content
Top Forums Shell Programming and Scripting Search patterns in multiple logs parallelly. Post 302884697 by Girish19 on Tuesday 21st of January 2014 11:43:10 AM
Old 01-21-2014
I tried to get the last lines of each log and search for the pattern using sed inside while condition.

Below is the code.
server_lno --> last line no of server log
jboss_lno --> last line of jboss log

Code:
                while [ `$SED -n "$server_lno,$ p" $SERVER_LOG | $GREP -E "Shutdown.*complete" | wc -l` -eq 0 -o `$SED -n "$jboss_lno,$ p" $JBOSS_LOG | $GREP -E "shutdown.*finished" | wc -l` -eq 0 ]
                do
                        sleep 10
                        count=`expr $count + 1`
                        if [ $count -eq $max_count ]; then
                                echo "Error"
                                exit 1
                        fi
                done

Here i am having an itteration of required condition is not met.
Itteration will have a tollerance limit of on max_count

I would like to know whether is there any way to check the in a single script only.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to parameterize multiple search patterns and generate a new file

I have one file: 123*100*abcd*10 123*101*abcd*-29*def 123*100*abcd*-10 123*102*abcd*-105*asd I would like to parameterize the search patterns in the following way so that the user could dynamically change the search pattern. *100* and *- (ie *minus) *102* and *- The output that is... (6 Replies)
Discussion started by: augustinep
6 Replies

2. Shell Programming and Scripting

Perl: Match a line with multiple search patterns

Hi I'm not very good with the serach patterns and I'd need a sample how to find a line that has multiple patterns. Say I want to find a line that has "abd", "123" and "QWERTY" and there can be any characters or numbers between the serach patterns, I have a file that has thousands of lines and... (10 Replies)
Discussion started by: Juha
10 Replies

3. Shell Programming and Scripting

Perl - How to search a text file with multiple patterns?

Good day, great gurus, I'm new to Perl, and programming in general. I'm trying to retrieve a column of data from my text file which spans a non-specific number of lines. So I did a regexp that will pick out the columns. However,my pattern would vary. I tried using a foreach loop unsuccessfully.... (2 Replies)
Discussion started by: Sp3ck
2 Replies

4. Shell Programming and Scripting

Search multiple patterns in multiple files

Hi, I have to write one script that has to search a list of numbers in certain zipped files. For eg. one file file1.txt contains the numbers. File1.txt contains 5,00,000 numbers and I have to search each number in zipped files(The number of zipped files are around 1000 each file is 5 MB) I have... (10 Replies)
Discussion started by: vsachan
10 Replies

5. Shell Programming and Scripting

search multiple patterns

I have two lists in a file that look like a b b a e f c d f e d c I would like a final list a b c d e f I've tried multiple grep and awk but can't get it to work (8 Replies)
Discussion started by: godzilla07
8 Replies

6. Shell Programming and Scripting

awk: Multiple search patterns & print in an one liner

I would like to print result of multiple search pattern invoked from an one liner. The code looks like this but won't work gawk -F '{{if ($0 ~ /pattern1/) pat1=$1 && if ($0 ~ /pattern2/) pat2=$2} ; print pat1, pat2}' Can anybody help getting the right code? (10 Replies)
Discussion started by: sdf
10 Replies

7. Shell Programming and Scripting

How to search Multiple patterns in unix

Hi, I tried to search multiple pattern using awk trans=1234 reason=LN MISMATCH rec=`awk '/$trans/ && /'"$reason"'/' file` whenevr i tried to run on command promt it is executing but when i tried to implment same logic in shell script,it is failing i.e $rec is empty ... (6 Replies)
Discussion started by: ns64110
6 Replies

8. Shell Programming and Scripting

How to search multiple patterns and remove lines from a file?

Hi, I have a file content as below. Table : PAYR Displayed fields: 15 of 15 Fixed columns: 4 List width 0999... (4 Replies)
Discussion started by: shirdi
4 Replies

9. Shell Programming and Scripting

Search and replace multiple patterns in a particular column only - efficient script

Hi Bigshots, I have a pattern file with two columns. I have another data file. If column 1 in the pattern file appears as the 4th column in the data file, I need to replace it (4th column of data file) with column 2 of the pattern file. If the pattern is found in any other column, it should not... (6 Replies)
Discussion started by: ss112233
6 Replies

10. Shell Programming and Scripting

Search Multiple patterns and display

Hi, I have scenario like below and need to search for multiple patterns Eg: Test Time Started= secs Time Ended = secc Green test Test Time Started= secs Time Ended = secc Green test Output: I need to display the text starting with Test and starting with Time... (2 Replies)
Discussion started by: weknowd
2 Replies
JavaMap(3)						User Contributed Perl Documentation						JavaMap(3)

NAME
Log::Log4perl::JavaMap - maps java log4j appenders to Log::Dispatch classes SYNOPSIS
############################### log4j.appender.FileAppndr1 = org.apache.log4j.FileAppender log4j.appender.FileAppndr1.File = /var/log/onetime.log log4j.appender.FileAppndr1.Append = false log4j.appender.FileAppndr1.layout = org.apache.log4j.PatternLayout log4j.appender.FileAppndr1.layout.ConversionPattern=%d %4r [%t] %-5p %c %x - %m%n ############################### DESCRIPTION
If somebody wants to create an appender called "org.apache.log4j.ConsoleAppender", we want to translate it to Log::Dispatch::Screen, and then translate the log4j options into Log::Dispatch parameters.. What's Implemented (Note that you can always use the Log::Dispatch::* module. By 'implemented' I mean having a translation class that translates log4j options into the Log::Dispatch options so you can use log4j rather than log4perl syntax in your config file.) Here's the list of appenders I see on the current (6/2002) log4j site. These are implemented ConsoleAppender - Log::Dispatch::Screen FileAppender - Log::Dispatch::File RollingFileAppender - Log::Dispatch::FileRotate (by Mark Pfeiffer) JDBCAppender - Log::Log4perl::Appender::DBI SyslogAppender - Log::Dispatch::Syslog NTEventLogAppender - Log::Dispatch::Win32EventLog These should/will/might be implemented DailyRollingFileAppender - SMTPAppender - Log::Dispatch::Email::MailSender These might be implemented but they don't have corresponding classes in Log::Dispatch (yet): NullAppender TelnetAppender These might be simulated LF5Appender - use Tk? ExternallyRolledFileAppender - catch a HUP instead? These will probably not be implemented AsyncAppender JMSAppender SocketAppender - (ships a serialized LoggingEvent to the server side) SocketHubAppender ROLL YOUR OWN
Let's say you've in a mixed Java/Perl enviroment and you've come up with some custom Java appender with behavior you want to use in both worlds, "myorg.customAppender". You write a Perl appender with the same behavior "Myorg::CustomAppender". You want to use one config file accross both applications, so the config file will have to say 'myorg.customAppender'. But the mapping from "myorg.customAppender" to "Myorg::CustomAppender" isn't in this JavaMap class, so what do you do? In your Perl code, before you call Log::Log4perl::init(), do this: $Log::Log4perl::JavaMap::user_defined{'myorg.customAppender'} = 'Myorg::CustomAppender'; and you can use 'myorg.customAppender' in your config file with impunity. SEE ALSO
http://jakarta.apache.org/log4j/docs/ COPYRIGHT AND LICENSE
Copyright 2002-2009 by Mike Schilli <m@perlmeister.com> and Kevin Goess <cpan@goess.org>. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.1 2010-02-07 JavaMap(3)
All times are GMT -4. The time now is 02:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy