I need some help here. I have a directory which has "x" no of files.
For each file it has data separated by "," !!! wow !! that is nice , we got delimiter now that makes life easy !!!
Now all what I want to do is any row(each row has 6 fields separated by ",") if it has 3 rd field as "abcdefgh" then I want to send that file as an attachment to user.
I have implemented the logic but it seems it send emails(spam) but all i want is just one email with that file(sending with uuencode).
Here is the code.
for i in $(find $BASE_DIRECTORY -type f -mtime -7)
while IFS="," read -r rec1 rec2 rec3 _
if [[ "$rec3" == "abcdefgh" ]]; then
echo -e "$i is the requested file"
uuencode $i $i|mailx -s "Invalid record $i file" email@example.com
echo "file $i is fine and does not need to sent"