Email searching with in scripts


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Email searching with in scripts
# 1  
Old 11-12-2008
Email searching with in scripts

Hi guys..

Would anyone know the best way to search 700 odd scripts so that it returns certain required results?

I need the search to return the script name, subject and any email address found.

The mail part of the script will look something like below and there can be more than one instance of mail being sent in the script..

mail -s "Subject" blah@blah.com how@help.com < $LOG

Have messed around with the grep but not getting too far..

Using .ksh..
# 2  
Old 01-30-2009
Try:
Code:
cd /top/script/dir
grep -h -r -E -o '[A-Za-z0-9_+.-]+@[A-Za-z0-9_+.-]+' . | 
 sort -t@ -u -k 2,3 -k 1,2  | 
 mail -s "Email addresses found" blah@blah.com

Needs GNU fileutils (grep) to work right. It sorts the email addresses by host name first, then by user.

Last edited by otheus; 01-30-2009 at 08:49 AM.. Reason: sort explanation added
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Display Pie Chart/Bar Graph in microsoft outlook email using UNIX commands/Shell scripts

I have a shell script which executes to write html codes into a text file. My next step is to email the text file so that receiving person (people who i send email to) should be able to see pie/chart or bar graph (whatever i design in my code) in their email. Following is the example of a sample... (7 Replies)
Discussion started by: bikerboy
7 Replies

2. Shell Programming and Scripting

searching a file with a specified text without using conventional file searching commands

without using conventional file searching commands like find etc, is it possible to locate a file if i just know that the file that i'm searching for contains a particular text like "Hello world" or something? (5 Replies)
Discussion started by: arindamlive
5 Replies

3. Shell Programming and Scripting

KSH - How to call different scripts from master scripts based on a column in an Oracle table

Dear Members, I have a table REQUESTS in Oracle which has an attribute REQUEST_ACTION. The entries in REQUEST_ACTION are like, ME, MD, ND, NE etc. I would like to create a script which will will call other scripts based on the request action. Can we directly read from the REQUEST_ACTION... (2 Replies)
Discussion started by: Yoodit
2 Replies

4. Shell Programming and Scripting

Write a scripts to kill idle user for 60 min. & email user list to admin in text file

Folks, I have written one script for following condition by referring some of online post in this forum. Please correct it if I'm missing something in it. (OS: AIX 5.3) List the idle user. (I used whoidle command to list first 15 user and get username, idle time, pid and login time).... (4 Replies)
Discussion started by: sumit30
4 Replies

5. Shell Programming and Scripting

Searching of IP_add in multiple scripts

Hi forum memebers, I want know what is the grep command a IP_add or host in the multiple scripts in one directory. Thanks in advance. Siva Ranganath.:) (3 Replies)
Discussion started by: sivaranga001
3 Replies

6. Shell Programming and Scripting

Searching of IP_add in multiple scripts! ASAP

Hello Friends, Plz help me for below query? I want search the IP_ADD from multiple files which are txt file or .sh files or .xml files which are present in different directories .Iam looking for Forum memebers help. Advance thanks to forum memebers.Plz reply me ASAP?:) (4 Replies)
Discussion started by: sivaranga001
4 Replies

7. Shell Programming and Scripting

KSH script to run other ksh scripts and output it to a file and/or email

Hi I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email. For example ------- Script ABC ------- a.ksh b.ksh c.ksh I need to call all three scripts execute them and... (2 Replies)
Discussion started by: pacifican
2 Replies

8. Shell Programming and Scripting

need help: how to send email with HIGH priority in shell scripts?

Hello, I know that mail or sendmail can be used to send email in a shell script. Is there any way I can set the priority of emails to send to HIGH? The reason why I want that is because my mobile email sends instant alert SMS's only for incoming emails with HIGH priority. (2 Replies)
Discussion started by: _joshua_
2 Replies

9. UNIX for Dummies Questions & Answers

How to add email notification in scripts?

Hi. I want to add email notification so when the my script finishes it sends out an email of the results to our team. If there are errors the subject on the email should say there were errors. If any having idea/sample scripts pls share with me. (2 Replies)
Discussion started by: redlotus72
2 Replies
Login or Register to Ask a Question