Sponsored Content
Top Forums Shell Programming and Scripting Sending files to multiple emails Post 302943722 by blackrageous on Tuesday 12th of May 2015 10:31:50 AM
Old 05-12-2015
I would actually use 2 arrays in the event the files aren't sequential. I don't know that you are really saving anything by shorting the number of lines.

Here something to consider...


Code:
#! /bin/bash
arr=(ragu.s kiran.m keeni.d rani.d sandya.s kartik.a samul.c hedge.b krishna.h ramya.v)
count=0
for i in ${arr[@]}
do
(( count++ ))
echo "Mail file${count}.csv to ${i}.hps.com"
done

Note: you would replace the echo statement with the correct system command for the mail command

i.e.

Code:
cat file.csv | mailx -s "subject" -u <user>

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Sending Emails to a unix process

Hi , I need to have a unix process which is setup to read all incoming mail for some user and process the same. How tough it is to code the same.Is there any way that we can download some shell scripts for the same from some internet site Kindly help. (2 Replies)
Discussion started by: xsriniva
2 Replies

2. UNIX for Dummies Questions & Answers

Sending Outgoing Emails from Unix Server

the server i have here is a Ubuntu server. it has nagios on it. after setting up nagios and having it work as it should, i realized at the very end of all my work that obviously nagios will also need to send out email alerts to a set of email addresses that it has in its database. my problem... (1 Reply)
Discussion started by: SkySmart
1 Replies

3. Programming

Sending emails in C program for multiple machines on Linux/OSX

Hey guys, i am creating a tool that'll run a couple network test, generate a report then email the report. Now i a bit stuck with the email sending part... I tried at first a script which worked on some machines but then it'll work fine on some machine and act up on others... I can't really rely... (2 Replies)
Discussion started by: Jess83
2 Replies

4. AIX

Need help on sending emails to Lotus Notes from Unix

Hi, I am new to UNIX and any help is greatly appreciated. Requirement: Need to check the directory and if the directory has some files then an email needs to be sent to the email ID on Lotus Notes. I need help on sending an email to email ID on Lotus Notes notifying that the files... (3 Replies)
Discussion started by: neetutg
3 Replies

5. Solaris

How to use text Fonts while sending emails from mailx?

Hi Team, I want to use "Courier New" fonts while sending emails using mailx command from solaris command prompt. Because my SQL output is not printing in correct format in the email. Please assist. Let me know for any details. Thanks, (1 Reply)
Discussion started by: Mukharam Khan
1 Replies

6. Shell Programming and Scripting

Counting lines and sending emails

What I am doing is running ps and search for any connection that is over a specified number, I set it to "1" for testing I want to send an email when any of them are over 50 I want them all in one email Below is the code what I want is to display the output of ps and grepping for "httpd" to a... (3 Replies)
Discussion started by: slufoot80
3 Replies

7. Shell Programming and Scripting

Hide from adress while sending emails

I have a shell script that sends email alerts to all the teams if there's any issue identified . This is the command that I use to send email alerts to others cat out.out | mail -s "Alerts on $date" $EMAILID Above code sends emails to all the users by default it sends emails to... (2 Replies)
Discussion started by: lazydev
2 Replies

8. Debian

Logcheck sending emails everywhere

Hi, I just recently installed logcheck running it at defaults. I don't have a /home/logcheck, even though the logcheck.conf MAILTO variable says "logcheck". Now I have a .forward in my regular home /home/awayand which gets an hourly report from logcheck but I have no clue how to turn that off. I... (0 Replies)
Discussion started by: awayand
0 Replies

9. Debian

Problem sending out emails

Hi, Our email relay server is a debian server. The application team in our company regularly receives email alerts from one hpux server (which is routed through the email relay server). Today we had problems whereby our company's email recipients are not receiving email alerts from the hpux... (2 Replies)
Discussion started by: anaigini45
2 Replies
MAILINSPECT(1)															    MAILINSPECT(1)

NAME
mailinspect - sort an mbox by category and pipe emails to a command. SYNOPSIS
mailinspect [-zjiI] -c category FILE [-gG regex]... [-s command] [-p style] [-o scoring] mailinspect -V DESCRIPTION
mailinspect reads the single mbox folder named FILE and sorts it in order of similarity to the category, which must have been created by dbacl(1). It can be used as a command line tool or interactively, when given the -I switch. When used as a command line tool, mailinspect prints the sorted list of emails on STDOUT. Each line consists of a seek position for the given email within FILE, followed by the score and a description string in one of several styles chosen via the -p option. When supplying a command string in conjunction with the -s option, mailinspect spawns a shell and executes command for every email in FILE (possibly selected via the -g or-G options), in the sorted order. This is similar to the formail(1) functionality, except the latter doesn't order the emails. In interactive mode, all the command line functionality is available via keypresses. The sorted list of emails is displayed in a scrollable format, and can be viewed, searched, tagged, resorted and sent to shell commands. Predefined shell commands can be associated with function keys. See the usage section below. The sorting heuristics are currently (and may always be) experimental, so there is no guarantee that the orderings are particularly well suited for anything. EXIT STATUS
mailinspect returns 1 on success, 0 if some error occurred. OPTIONS
-c Use category to compute the scores and sort the emails, which should be the file name of a dbacl(1) category. -g Only emails matching the regular expression regex are sorted. All other emails are ignored. When several -g and -G options are present on the command line, earlier regular expressions are overridden by later ones where applicable. -i Force internationalized mode. -j Force regular expression searches to be case sensitive. -o Determines the scoring formula to be used. The parameter scoring must be an integer greater than or equal to zero. By default, scor- ing equals zero. -p Prints the email index in the given style. The parameter style must be an integer greater than or equal to zero. By default, style equals zero. -s For each email in the list, execute the shell command, with the email body on STDIN. Emails are processed in sorted order. -z Reverse sort order. Normally, emails are sorted in order of closest to furthest relative to category, but in this case, the opposite is true. -I Interactive mode. Instead of printing the sorted list of emails on STDOUT, emails are displayed and can be scrolled, viewed, searched and piped interactively at the terminal. -G Only emails not matching the regular expression regex are sorted. Opposite of -g switch. -V Print the program version number and exit. USAGE
mailinspect needs to read a prelearned category before it can sort the emails in FILE. See dbacl(1). Suppose you have two mail folders named good.mbox and bad.mbox respectively. You can create appropriate categories by typing the commands % dbacl -l good good.mbox -T email % dbacl -l bad bad.mbox -T email Next, you can type the following command to view interactively the bad.mbox file with the emails whose score is closest to the category good listed first: % mailinspect -I -c good bad.mbox Alternatively, you might be interested only in the five emails in the folder bad.mbox whose score marks them as the furthest away from the category bad, completely independently from any other category such as good (ie you want outliers in the scoring sense). % mailinspect -z -c bad bad.mbox | head -5 In interactive mode, the following keys are defined: o toggles another scoring formula. p toggles another display style. q exits mailinspect. s sends the currently highlighted email to a shell command. S sends all currently tagged emails to a shell command, in sorted order. Every email executes the shell command independently. t tags the currently highlighted email. T tags all listed emails. v sends the currently highlighted email to $PAGER for viewing. If the environment variable PAGER is not defined, sends the email to less(1). u untags the highlighted email. U untags all listed emails. z reverses the sort order of displayed emails. / searches for a regular expression (see regex(7)) anywhere within the contents of all listed emails. Hides all emails which don't match. ? like /, but hides all emails which match, keeping all those which don't match. As a convenience, the function keys F1-F10 can each be associated with a shell command string. In this case, typing a function key has the same effect as the S key, but the command is already typed and ready to be edited/accepted. The function key associations are read from the configuration file .mailinspectrc if it exits. FILES
$HOME/.mailinspectrc mailinspect reads the file .mailinspectrc in the $HOME directory, if it exists. This is a plain text file which contains entries of the form # this is a comment F2 cat >> interesting.mbox F5 mail zarniwoop@megadodo.com ENVIRONMENT
DBACL_PATH When this variable is set, its value is prepended to every category filename which doesn't start with a '/'. SOURCE
The source code for the latest version of this program is available at the following locations: http://www.lbreyer.com/gpl.html http://dbacl.sourceforge.net AUTHOR
Laird A. Breyer <laird@lbreyer.com> SEE ALSO
bayesol(1), dbacl(1), less(1), mailcross(1), regex(7) Version 1.12 Bayesian Text Classification Tools MAILINSPECT(1)
All times are GMT -4. The time now is 01:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy