Sponsored Content
Top Forums Shell Programming and Scripting How to search the multiple strings in app server.log? Post 303029518 by nezabudka on Monday 28th of January 2019 09:44:31 AM
Old 01-28-2019
it is not clear how your program works with such the logfile and where figure 10239 came from?

--- Post updated at 14:44 ---

Code:
grep -o "Simon[^<]*" server.log

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem to search multiple strings

Hi all, I am search a string from a file using following command, I want to pick the message ( I.e print $5) from the lookup file if and only if both $hostname and $instancename match. Message=`cat $lookup_tbl| awk '/'$category'/ {if ('$hostname' == '$2' || '$instancename' == '$3') print $5}'`... (2 Replies)
Discussion started by: sudhish
2 Replies

2. Shell Programming and Scripting

How to search multiple strings in a file

Hi All, I want to search all the ksh scripts that has following details. 1. Search for "exit 0" 2. Search for "sqlldr" or sqlplus" 3. In the above files i want to search for all the script that has no "case" in it. Please advice. Thanks, Deep (2 Replies)
Discussion started by: deepakpv
2 Replies

3. UNIX for Dummies Questions & Answers

Search for multiple strings and mail accordingly

Hi, I need to find if there is any error in the last few lines of the log file and send a mail accordingly.For example, Following errors can be logged in the log file. ERR_1="DB Connection not established" ERR_2="Server Unloading" I need to find if these errors are found in the log file and... (3 Replies)
Discussion started by: AnneAnne
3 Replies

4. Shell Programming and Scripting

Search for multiple strings in specific position

Hi, I need to search for some strings in specific positions in a file. If the strings: "foo1", "foo2" or "foo3" is on position 266 or position 288 in a file i want the whole line printed. Any idea how to do it? (5 Replies)
Discussion started by: HugoH
5 Replies

5. Shell Programming and Scripting

Search multiple strings on a file and copy the string next to it

I tried awk for this, but failed <or my code is not correct? I dont know>. Can anyone help me on this? ---------- Post updated at 08:34 PM ---------- Previous update was at 08:29 PM ---------- my working file looks like this: <empty> <empty> <empty> NAME :ABC AGE :15 GENDER... (6 Replies)
Discussion started by: kingpeejay
6 Replies

6. Shell Programming and Scripting

Search multiple Strings in a File

Hi I want to search multiple strings in a file . But the search should start with "From" Keyword and end with before "Where" keyword. Please suggest me. Thanks (2 Replies)
Discussion started by: sboss
2 Replies

7. Shell Programming and Scripting

Search & Replace: Multiple Strings / Multiple Files

I have a list of files all over a file system e.g. /home/1/foo/bar.x /www/sites/moose/foo.txtI'm looking for strings in these files and want to replace each occurrence with a replacement string, e.g. if I find: '#@!^\&@ in any of the files I want to replace it with: 655#@11, etc. There... (2 Replies)
Discussion started by: spacegoose
2 Replies

8. Shell Programming and Scripting

Whether we can search multiple strings using or in grep -F

Hi, Whether we can search multiple strings using or in grep -F In Generally, grep -F "string1" "filename.txt" How to search for multiple string using grep -F as we using grep grep "string1\|string2" "filename.txt" Regards, Nanthagopal A (10 Replies)
Discussion started by: nanthagopal
10 Replies

9. Shell Programming and Scripting

Multiple search strings replaced with single string

Hi, I need someone's help in writing correct perl code. I implemented following code for "multiple search strings replaced with single string". ========================================================= #!/usr/bin/perl my $searchStr = 'register_inst\.write_t\(' |... (2 Replies)
Discussion started by: chettyravi
2 Replies

10. Shell Programming and Scripting

Search between two strings for multiple occurances

i search between two strings viz <app-deployment> & </app-deployment> and save the contents in a new file using the code snippet below. sed -n "/<app-deployment/,/<\/app-deployment>/p" deploy.tmp >found1.tmpBut if the search string apprears more than once in the file then how can i store the... (3 Replies)
Discussion started by: mohtashims
3 Replies
logcheck-test(1)					      General Commands Manual						  logcheck-test(1)

NAME
logcheck-test - test new logcheck rules easily SYNOPSIS
logcheck-test [-q|-i] [-a|-s|-l FILE] [-e] [-P PREFIX] [-S SUFFIX] RULE logcheck-test [-q|-i] [-a|-s|-l FILE] -r RULEFILE DESCRIPTION
logcheck-test parses a log file for matching lines specified by a single rule or a rule file. If using a single RULE you can set a PREFIX and a SUFFIX to write new rules easily. OPTIONS
-h, --help Show usage information -a, --auth.log Parse /var/log/auth.log for matching lines -s, --syslog Parse /var/log/syslog for matching lines -l, --log-file FILE Parse FILE for matching lines -i, --invert-match Show line that don't match the RULE or the RULEFILE -q, --quiet Suppress rule summary at the end of output -e, --surround-rule Surround RULE with standard prefix and suffix: ^[[:alpha:]]{3} [ :[:digit:]]{11} [._[:alnum:]-]+ RULE$ -P, --append-prefix PREFIX Append PREFIX to rule prefix. Option can be given multiple times -S, --prepend-suffix SUFFIX Prepend SUFFIX to rule suffix. Option can be given multiple times -r, --rule-file RULEFILE Use file RULEFILE for rule input EXAMPLES
With logcheck-test you can easily write and test new rules. Test a single rule against /var/log/syslog: logcheck-test -s "RULE" Test a single rule against ~/log, surround the rule with standard prefix and suffix and append "kernel " to prefix: logcheck-test -l ~/log -e -P "kernel " "RULE" Test the rules in rulefiles/linux/ignore.d.server/kernel against ~/log: logcheck-test -l ~/log -r rulefiles/linux/ignore.d.server/kernel Test which lines the rules in rulefiles/linux/ignore.d.server/kernel doesn't match: logcheck-test -l ~/log -r rulefiles/linux/ignore.d.server/kernel -i EXIT STATUS
On successful matching logcheck-test will complete with exit code 0. An exit code of 1 indicates no successful matching. An exit code greater then 1 indicates an error occurred. Textual errors are written to the standard error stream. SEE ALSO
logcheck(8) AUTHOR
logcheck is developed by Debian logcheck Team at alioth: http://alioth.debian.org/projects/logcheck/. This manual was written by Hannes von Haugwitz <hannes@vonhaugwitz.com>. Feb 19, 2010 logcheck-test(1)
All times are GMT -4. The time now is 06:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy