Sponsored Content
Full Discussion: Exclude string
Top Forums Shell Programming and Scripting Exclude string Post 302933427 by ust3 on Thursday 29th of January 2015 09:20:42 PM
Old 01-29-2015
Exclude string

I would like to write a script to check the log , if any line in the log have the string in include_list.txt but do not have the string in exclude_list.txt , then send alert mail to administrator , as below example , the line 1 have the string "string 4" ( which is in include_list.txt ) but do not have anything in exclude_list.txt , then display line 1 only in alert mail .
Would advise how to write this script ? very thanks .

Code:
#vi exclude_list.txt
string 1
string 2
string 3

Code:
#vi include_list.txt
string 4
string 5
string 6

For example
============
Code:
xxx string 4 xxxstring 2
xxx string 4 xxxxxxxxxx
xxx string 4 xxxxxxxxxx
xxx string 4 xxxxxxxxxx
xxx string 4 xxxxxxxxxx
xxx string 4 xxxxxxxxxx
xxx xxxxxxx xxxstring 3


Last edited by ust3; 01-30-2015 at 04:06 AM.. Reason: Add CODE tags again.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Getting 'tar' to exclude

I want 'tar' to exclude certain dir's. tar cvf ............. ............ does the whole lot, but I want to exclude the 'log' dirs. (6 Replies)
Discussion started by: kuultak
6 Replies

2. UNIX for Dummies Questions & Answers

Exclude list

Hi, I am trying to exclude "/web" directory from a server. I am able to login to the server, and this is the command it gives me: $ /usr/openv/netbackup/exclude_list bash: /usr/openv/netbackup/exclude_list: No such file or directory can anyone pls help me :confused: (3 Replies)
Discussion started by: decamposem
3 Replies

3. SCO

Tar exclude

Hi, We work on a UNIX SCO SCO_SV Release = 3.2v5.0.5. I have a folowing structure /u/usr/lpp /u/usr/lpp/SQL /u/usr/lpp/DIR2 I use following tar to backup the /u/usr/lpp directory cd /u/usr/lpp tar cvf /u/usr/backup/backup.tar . Now I want to exclude the subdirectory SQL. I... (2 Replies)
Discussion started by: haezeban
2 Replies

4. Ubuntu

[Solved] Using Find with an exclude/exclude file

I am familiar with using tar and exclude/include files: tar zcf backup.dirs.tgz --files-from=include.mydirs --exclude-from=exclude.mydirs --no-recursion but was wondering if I could use find in the same way. I know that you can just specify the directories to exclude but my list is... (2 Replies)
Discussion started by: metallica1973
2 Replies

5. Shell Programming and Scripting

Exclude a file or not in

Hi Gurus. I have a directory and i receive many files with extension .log. I processed the file as i get it. i want to process all the files except one which i know i don't want to process. cd /backup/temp/rajesh/PACS #--- directory , under this i have below files... (1 Reply)
Discussion started by: guddu_12
1 Replies

6. Shell Programming and Scripting

To exclude a string from monitoring

Hi below is my current scripting which will monitor for any errors in the application logfile="/tmp/application.log" output=$(grep "ERROR" $logfile) if then echo "found- send email" else echo "not found" fi Now I wanted the script not to send the email for one of the... (12 Replies)
Discussion started by: ajothi
12 Replies

7. Shell Programming and Scripting

Exclude files in ls

Hi, I need to exlucde the files which are present in exclude.txt from a directory exlcude.txt AUZ.txt AUZ.chk NZ.txt NZ.chk tried with below code but not working ls -ltr | grep -v `cat exclude.lst` (9 Replies)
Discussion started by: rohit_shinez
9 Replies

8. Shell Programming and Scripting

Exclude certain folders

Hi Experts, Below is my shell script and it will move the files older than 90 days to archive mount. Now my new requirement is , I need to move some of the directory files older than 365 days. How can I achieve this. Simply I have DIR1 DIR2 DIR3 DIR4 I need to exclude DIR 2 and DIR 2... (5 Replies)
Discussion started by: arumugavelvelu
5 Replies

9. UNIX for Dummies Questions & Answers

Du exclude in Solaris

How do you exclude a filesystem using du command in solaris? for example /proc Tried this but its not working du -sk -d /* --exclude=/proc | sort -nr | cut -f2 | xargs du -sh | head - in linux it is working. (2 Replies)
Discussion started by: jinslick25
2 Replies

10. Shell Programming and Scripting

Du exclude in Solaris

How do you exclude a filesystem using du command in solaris? for example /proc Tried this but its not working du -sk -d /* --exclude=/proc | sort -nr | cut -f2 | xargs du -sh | head - (1 Reply)
Discussion started by: jinslick25
1 Replies
WRITELOG(8)						      System Manager's Manual						       WRITELOG(8)

NAME
writelog - add a entry to an INN log file. SYNOPSIS
writelog name text... DESCRIPTION
The writelog script is used to write a log entry or send it as mail. The name parameter specifies the name of the log file where the entry should be written. If it is the word ``mail'' then the entry is mailed to the news administrator, <USER specified with --with-news-mas- ter at configure>. The data that is written or sent consists of the text given on the command line, followed by standard input indented by four spaces. Shlock(1) is used to avoid simultaneous updates to a single log file. HISTORY
Written by Landon Curt Noll <chongo@toad.com> and Rich $alz <rsalz@uunet.uu.net> for InterNetNews. This is revision 5909, dated 2002-12-03. SEE ALSO
innd(8), innstat(8), news.daily(8), newslog(5), nnrpd(8), scanlogs(8). WRITELOG(8)
All times are GMT -4. The time now is 02:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy