Sponsored Content
Top Forums Shell Programming and Scripting How to search the multiple strings in app server.log? Post 303029546 by RudiC on Monday 28th of January 2019 04:30:42 PM
Old 01-28-2019
Wouldn't it be nice to show WHAT the problem is, and when it occurs? Do the individual elements work, i.e. was the "paymentfailed.log" file created? Does the mailx command work on itself (no extras, no (or simple) subject, no options, ...)?
Do you need the "paymentfailed.log" for later processing? If not, pipe the awk output immediately into mailx.
Why do you define the SERV and FDATE variables and then don't use them?
 

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
FILTER(1)						      General Commands Manual							 FILTER(1)

NAME
filter - filter incoming messages before adding to mailbox SYNOPSIS
filter [-q] [-v] [-l] [-o output] [-f rules-file] [-m mailbox] filter [-n] [-f rules-file] filter [-r] [-o output] [-f rules-file] filter [-c] [-s] [-o output] [-f rules-file] filter [-c] [-S] [-o output] [-f rules-file] DESCRIPTION
In brief, filter is designed to sort incoming mail based on user preferences for various recognized headers. It logs a summary of messages filtered to a logfile. See the USAGE section for full details. OPTIONS
The flags the filter program understands are; -c Clear logs. If this flag is used, the log files will be removed after being summarized by either "-s" or "-S" (see below). -f rules-file Get rules from specified file instead of default $HOME/.filter/filter-rules -l Log actions only. Do not log information about mailed messages. -n Not really. Output what would happen if given message from standard input, but don't actually do anything with it. -o file Redirect stdout messages to the specified file or device. Logging of filter actions is not affected. (This is added to more gracefully deal with changes in the file system (since sendmail is quite picky about modes of files being redirected into.)) -m mailbox Override the compiled in definition of your primary 'mailbox'. This is disabled if filter is setgid. -q Quiet. Do not log filtering actions. -r Rules. List the rules currently being used. -s Summarize. List a summary of the message filtering log. -S This is the same as `-s' but includes message-by-message information additionally. -v Verbose. Give output on standard out for each message filtered. May be useful to set output to ``/dev/console'' or other log- ging device. (see -o). USAGE
Filter uses a set of selection rules to process incoming mail messages. These rules are normally read in from $HOME/.filter/filter-rules. As soon as a rule matches something about the message, that rule is used, and no further action is taken. The general format for a rule is; if (expression) then action where expression is: expression ::= { not } condition { and expression } condition ::= field = stringvalue ::= field != stringvalue ::= lines relop numvalue or ::= always These further break down as: field ::= from | subject | alphasubject | to | lines | sender relop ::= = | != | < | > | <= | >= stringvalue ::= any quoted string numvalue ::= any integer value Note: alphasubject is a transformed version of the subject line, where only alpha chars are preserved, and they are forced to lower case. It is then simpler to use a regular expression match across a wide variety of similar subjects. from matches any and all of the following headers: "From " From: Reply-To: Sender: Action can be any of: delete (ignore this message; throw it away) save foldername (put in 'foldername' for later) savecopy foldername (save a copy AND put in my inbox) execute command (pipe message to 'command') executec command (copy to inbox, AND pipe to 'command') forward address (forward this message) forwardc address (forward this message, AND copy to inbox) resend address (resend to new addr without change) leave (just put it in my inbox) bounce (say there's no such user) An example of a rules file would be: # I'll read this stuff later when I feel like it if (from = "list@interest.org") then save "~/Mail/mailinglist" # This mailing list actually has an x-mailing-list header if (mailinglist = "smartlist@other.com") then save "~/Mail/otherlist" # auto-archive this project's email, AND put in my current mailbox if (subject = "strange project") then savecopy "~/Mail/proj-archive" # If "make money" appears ANYWHERE in subject, upper/lowercase, # delete the lousy spam if ( subject = "make money" ) then delete # This person no longer shares this virtual mailbox with me. # Resend visibly as a "forwarded" message. if (to = "partner") then forward "partner@new.address.com" # If email for an old address comes to me, resend to new one. # Note that the "envelope" will show my address, but the # normal headers will not if ( to = "old_address" ) then resend new@address.here" # Special virtual headerline derived from normal subject line # catches "multiple!!!wor+ds**here" if ( alphasubject = "multiplewordshere" ) then delete # If email for a special address comes to me, resend through # a non-standard "special" mailer if ( to = "special_address" ) then exec "/usr/lib/mailer special@addr" # # The rules file doesnt really need parentheses. Or even the 'if'. # They are just traditional. subject = "silly" then bounce Note that all filenames must be double-quoted For further information about the rules language, please see The Elm Filter Guide. MAINTAINER
Philip Brown FILES
$HOME/.filter/filter-rules Default rules file $HOME/.filter/filterlog A log of what has been done $HOME/.filter/filtersum A summary of what has been done $MAIL IF you set this var, defines your default mailbox /etc/passwd Used to get users home directory SEE ALSO
The Elm Filter Guide (distributed with the source code) mail(1), mailx(1), sendmail(1,8) COMMENTS
Could be smarter about pattern matching. Message body checks might be nice too. Please note that this was historically bundled with the elm mail reader, but now can be found at http://www.bolthole.com/filter/ BUG REPORTS TO
filter@bolthole.com COPYRIGHTS
Copyright 1988-1992 by The USENET Community Trust Derived from Elm 2.0, Copyright 1986, 1987 by Dave Taylor USENET Comm. Trust 19 April 2004 FILTER(1)
All times are GMT -4. The time now is 06:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy