- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Seperating data from a file
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-18-2008 09:17 PM
тАО12-18-2008 09:17 PM
Re: Seperating data from a file
for file in what-ever; do
mailx -s "${email_subject:?}" "${email_recipients[@]:?}" < $file
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-19-2008 04:48 AM
тАО12-19-2008 04:48 AM
Re: Seperating data from a file
u specified as
"for file in what-ever; do"
what-ever means?
I have to specify anything, could you please example
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-19-2008 05:47 AM
тАО12-19-2008 05:47 AM
Re: Seperating data from a file
You need to mention how you get those 100 files. If you do them one by one, then you can remove that for loop and just use $2.tmp.
If you are going to do them all at once, you will need to get a list of those files. Either from ls(1) or from a file. You need to be more specific where that mail command goes after you create the file(s).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-19-2008 06:01 AM
тАО12-19-2008 06:01 AM
Re: Seperating data from a file
In that case you need to read each PO file and extract the name and then convert that to an email address based on whatever format you use.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-19-2008 06:13 AM
тАО12-19-2008 06:13 AM
Re: Seperating data from a file
'WHAT PROBLEM ARE YOU REALLY TRYING TO SOLVE'.
WHY stick each order in a unique file, only to Email thme out? a SHELL or PERL script could just keep all data in memory and call mail directly from a sub-process feeding it the lines without ever needing a temp file to hold an order.
The AWK script could easily detect the new order condition END as well as the already present /^PURCHASE_ORDER_NO/ test, and then just do the Email of the past order right there and then, re-suing the same file (name) for the next order, renaming failed sends to a file to remain on the box with the order number in the file. Or in sticking with the unique names, perhaps delete succesfully send temp files.
HOW will you determine the "to:" Email address? Can that be integrated in the scripts? Perhaps a helper file with (phone) number to Email mapping?
Good luck!
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-19-2008 03:32 PM
тАО12-19-2008 03:32 PM
Re: Seperating data from a file
Now I am able to send individual email for every individual file by the using the below code
for file in `ls /home/abc/*.tmp`
do
if test -s "${file:?}"
then
elm -s "${email_subject:?}" "${email_recipients[@]:?}" < $file
fi
done
Now I want to use only file name from the /home/abc directory and place that filename in the email subject for every email
the email subject should be like this "welcome abc.txt"
how can I place name of the file in the code could you please help me
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-19-2008 04:29 PM
тАО12-19-2008 04:29 PM
Re: Seperating data from a file
filename=`basename $file`
elm -s "$filename" "${email_recipients[@]:?}" < $file
You can append or prepend any other text in the filename variable
- « Previous
-
- 1
- 2
- Next »