Tail multiple files. Combine them and email it

Tuesday, July 8, 2014

Currently I have a script that looks like this.



#!/bin/bash

#my first file I am grabbing
fnFirstFile()
{
tail -24 /folder/file1.csv | head -19
}

##Email to the person you want.
fnEmailFunction()
{
fnFirstFile| mail -s 'Title' bob@123.com
}

##Calling my function email.
fnEmailFunction


This script tails/heads one file and emails that excel data to my email. I'll looking to add another file and combine it with with the data on the first email. Below is what I am adding to my first script to print out data I want from the 2nd file.



#my second file I am grabbing
fnSecondFile()
{
tail -24 /folder/file2.csv | head -19
}


Unfornatantly I'm not 2 sure on how to call 2 functions within my fnEmailFunction and then email them all. Could any more assist me or give some pointers on how to do this ? Thank for very much in advance.


My result should look like something like this in my email.



Title
To : bob@123.com
From : me@123.com

[ fnFirstFile data]
21321
324234
3432
3423

[ fnSecondFile Data]
23424
34324
343223
32






http://ift.tt/1qHGvdd