Page 1 of 1

Need to mail attached file only when data is present

Posted: Fri Jan 30, 2009 7:35 am
by senthilmp
Hi,

My aim is to attach file and send it through mail, if the file has records inserted into it.

Current Design:
The property of Seq file stage is Create file and First line as ColumnName- Checked.
Am trying to trigger mail attaching the file using unix script, if any records is inserted into the file. The problem i am facing here is , the mail is triggered even when there is no records passed in the file, because the file is having the column name created (since First line as column is checked).

Pls let me know how can i overcome this issue or is any better way to design this?

**Note: Subject changed to be more descriptive - Content Editor **

Posted: Fri Jan 30, 2009 7:40 am
by throbinson
In UNIX script interrogate for a file that has more than one line, like;
LINECOUNT=`/usr/bin/wc -l <file>`
if [[ $LINECOUNT -gt 1 ]]; then
mail it.
fi

Posted: Fri Jan 30, 2009 8:11 am
by senthilmp
Thanks Robinson for your quick response. Its working now.
Great.