The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
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 04:25 PM
mail with attachment param786 Shell Programming and Scripting 1 07-15-2007 11:20 AM
How To Add Attachment to Mail lesstjm Shell Programming and Scripting 3 12-06-2005 11:24 AM
mail attachment sushrut UNIX for Dummies Questions & Answers 3 08-28-2001 02:14 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-19-2007
jagadeeshtata jagadeeshtata is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 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.
  #2 (permalink)  
Old 11-19-2007
benefactr benefactr is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 71
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:
Originally Posted by jagadeeshtata View Post
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.
  #3 (permalink)  
Old 11-19-2007
prowla prowla is offline
Read Only
  
 

Join Date: Nov 2007
Posts: 165
grep myvariable myfile | mailx -s mysubject me@myaddress
  #4 (permalink)  
Old 11-19-2007
edcrosbys edcrosbys is offline
Read Only
  
 

Join Date: Jul 2007
Posts: 15
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
Sponsored Links
Closed Thread

Bookmarks

Tags
mailx, mailx attachment

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 05:24 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0