My goal is to send multiple files to a person based on their input. The files have similar names like:
The script is run with the filename given as arguments, such as:
would email all of the above files.
The script I have currently does email all the files, but it puts each into it's own email and I would like file1 and file2 grouped and stuff1 and stuff2 grouped, etc. Here's what I have:
I think that should be pretty easy to read through, but if there is a better way to go about that portion, I'd be very happy to learn a better way.
As stated above, my main question is, is it possible to differentiate between file1 and 2 and stuff1 and 2 to put them in different emails via multiple -a flags on the mutt line.
I hope that was all coherent. Thanks for your help!
Shell Life, wouldn't that just join all the files into a single file and email that?
I want one email to go out with file1 and file2 attached (
) and another email with stuff1 and stuff2 attached.
Is it possible to make the loop differentiate? I was thinking of holding the file it just emailed in the current loop to a variable, and then test that against the next file it was going to email and if they match, put them in the same email but if not, start a new mutt line.
I'm stepping a little above my head with that, and I'm not sure it's even possible.
Wow, very nice Shell_Life... you never let me down!
The nested loops really ..."threw me for a loop" at first, but I echoed the var after each one and I got it now. That is very nice. I think I'm finally learning the syntax and such, I just need to develop the ability to "think outside the box" on things such as this.
One quick issue. I modified your script as shown above. The problem is I need to delete the .txt files that it's creating, but at the bottom of the loops where I rm it, the variable only has one file or the other (file1 or file2) thus leaving the other.
For shell script. If I had two separate files, file.txt and file1.txt and each has just a list of names from the who command. How would I create an if loop to compare each name? (1 Reply)
Hey guys.
I have been trying to figure out an easy way to seperate a liste of 150k numbers (10 digits) in a .txt file into odd and even numbers with each of their own files, for a project at work.
I've tried Excel, but it was too much for it and it wasnt very simple. So i gave up after... (13 Replies)
Hi All,
I want to send each file to each email id as below.
Instead of writing saparate 10 mail commands
can we do it in a simple step.
file1.csv to raghu.s@hps.com
file2.csv to kiran.m@hps.com
file3.csv to kenni.d@hps.com
file4.csv to rani.d@hps.com
file5.csv to sandya.s@hps.com... (2 Replies)
Hello,
A while back someone"archived" my emails for me, so I didn't have to worry about my email account filling up with emails.
I need to get back into those emails and view them.
When I opent the folder it has several files. The largest being an "mbox", which I am assuming has all of... (3 Replies)
Hi,
My first post!!
I have a files with header, something like this
Header_Row
AMC|D1|D2|D2
AAO|D3|D4|D5
AMC|D6|D7|D8
AAO|D9|D10|D11
.
.
.
.
.
and millions fo records thereafter like this.
I want to read the above file in a loop and write the lines having AMC into another... (1 Reply)
Hello,
I need help finding a script that will allow me to move files from one directory to another directory 10k files at a time.
I have a directory that has 100 K files in it. I need to have those 100k files broken apart to separate directories each with 10k files in them.
Here is the... (8 Replies)
Hello,
I am comparing files with for mismatches using fgrep but I've run into a problem.
fgrep -vf $file1 $file2 > mismatches.dat
file1 and file2 both contain file names on each line
file1 has filenames which are up to 92 characters long and contain the "$" char.
example file name:... (2 Replies)
Hi,
So I have a text file which I want to separate into separate text files. I would use the split command but the problem here is that the text file is separated by delimiters. For example:
blah
blah blah
------
more text
-----
and some more text
So basically the first part should be... (4 Replies)
I am using
printf "%-75s%+10s %5s %1s \n" $s $z $x $y > status
It works really well, however, when I email status it is sending 10 emails when I would like it to be in one.
Is there a way to make all the output to go into one instance of a txt file. Yet still keep it 1 on each... (12 Replies)