![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| mailx commannd - Mail and Attachment in same mail | sharif | UNIX for Advanced & Expert Users | 6 | 03-19-2008 01:25 PM |
| mail with attachment | param786 | Shell Programming and Scripting | 1 | 07-15-2007 08:20 AM |
| How To Add Attachment to Mail | lesstjm | Shell Programming and Scripting | 3 | 12-06-2005 08:24 AM |
| mail attachment | sushrut | UNIX for Dummies Questions & Answers | 3 | 08-27-2001 11:14 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
search a string and mail it as attachment
Hi All,
I need to search a text in a string, assign it to a variable. Ex : I need to get the number that has gif extension. The number is not constant. The search value should return as 1174499845 from the following string. x 1174499845.gif, 133982 bytes, 262 tape blocks Go to relevant directory, search for the the variable (example 1174499845) in the directory. if exists Mail it as attachment else display "required attachment" not available. Thanks in advance. Jagadeesh Tata. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Here's a rough ideal on what you need to do.. Assuming you are just looking for one file at a time.
ls ${DIR} | grep "$VARIABLE" if [ $? -eq 0 ] then <do mail command here, unsure how to do attachment as this moment> fi Quote:
|
|
#3
|
|||
|
|||
|
grep myvariable myfile | mailx -s mysubject me@myaddress
|
|
#4
|
|||
|
|||
|
Text files can easily be sent as the body of an email as shown above. If you need to send something as an attachment, you have to encode it. I like mpack, but have used uuencode as well. Here's my snippets:
cat filename | uuencode attachmentName | mailx –m –s “Subjest” someone@somewhere.com #/usr/local/bin/mpack -s "Test Email" -c application/octet-stream ./oracle_trace_file.trc me@myaddress.com |
|||
| Google The UNIX and Linux Forums |
| Tags |
| mailx, mailx attachment |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|