If I am asking this question, you must have already figured out , that I am new to Unix, so here it goes
I was trying to read a file, add some user defined content to it and send out an email , I did find out a way to achieve this, but looking at the code, it looks a bit crude to me, can you guys point out a more efficient way of writing this?
Here is the my Input file id_list.txt
And this is what I expect to be sent in the email
And this is what I wrote
Can someone point out a better way to write this? Also can you also explain, instead of writing the file to the final_op.txt , if i pipe it to the mutt command, the email comes up in a non formatted way, that is the text inside the while loop comes up in a single line. But if i seperate it out it comes as I have mentioned in the expected output .
If I am asking this question, you must have already figured out , that I am new to Unix, so here it goes
I was trying to read a file, add some user defined content to it and send out an email , I did find out a way to achieve this, but looking at the code, it looks a bit crude to me, can you guys point out a more efficient way of writing this?
Here is the my Input file id_list.txt
And this is what I expect to be sent in the email
And this is what I wrote
Can someone point out a better way to write this? Also can you also explain, instead of writing the file to the final_op.txt , if i pipe it to the mutt command, the email comes up in a non formatted way, that is the text inside the while loop comes up in a single line. But if i seperate it out it comes as I have mentioned in the expected output .
Could you clarify how you want the output (the mail message) not to be a single line?
Hi hanson44,
Karthi provided sample output showing exactly the format of the message wanted.
However, Karthi did not say what OS is being used. And, has been stated in this forum dozens (if not hundreds) of times before, you should never use echo if any operand contains a backslash character nor if any argument starts with a minus sign if you want to use your script on different systems. The replacement script I provided replaces the non-portable echo commands with portable printf commands and should produce mail messages in the stated format without the need for a temp file.
As far as why Karthi got a single line of output, I don't know. Even on a system that treats -n as a request to skip the trailing newline and does not translate \n to a newline, there still should have been two lines of output rather than one.
HI Team,
I am working on reading hive table and send email in email body using shell script, can you please help on fixing the errors: I have 6 columns in my hive table and trying to send the email in the mail body.
below script:
#!/bin/bash
hive -e 'SELECT count(*) from db.table' >... (4 Replies)
Please help!!
This code works perfect but the only problem I am having is that is treats eg SQL Developer as separate cell/column which makes the formatting bad. I want to put SQL Developer in one cell. I attached a sample of how the output looks like.
report.txt
USERNAME OSUSER ... (5 Replies)
I have a file like this. I need to ues this file to send emails to the appropriate ID/group.
For instance in the first line
- Subject should be --> "A1.csv - ABC"
- Body should be --> File A1.csv has changed.
- Email should be sent to A1@xyz.com,A3@xyz.com
Lookup.csv:
... (1 Reply)
My batch files run every day, it moves files from servers to my local computer, can I have a confirmation email sent to me from this batch file saying if the job failed or successes? Thank you for your help! (6 Replies)
Hi Experts,
I have a script like
$ORACLE_HOME/bin/sqlplus username/password # << ENDSQL
set pagesize 0 trim on feedback off verify off echo off newp none timing off
set serveroutput on
set heading off
spool Schemaerrtmp.txt
select ' TIMESTAMP COMPUTER NAME ... (5 Replies)
So I was just wondering... Is there a way to send a file directly to the computer..... Ive never gotten the answer and I want to know how, I keep running in to a wall :wall:. Why you may ask, well really for security reasons due to the fact that if this is done via a port I want to make sure to... (3 Replies)
Hi !
I am a newbie and never officially wrote a shell script before.
The requirement for this script is :
1) Read a file called 'bpm.log' and identify if it has a specific text such as 'this is the text'. Its a static value and that is the only text we need to read.
2) If that... (2 Replies)
Hello ,
I am trying to write a unix shell script to compare folder permission to say drwxr-x-wx and then send an email to my id in case the folders don't have the drwxr-x-wx permissions set for them .
I have been trying to come up with a script for few days now , pls help me:( (2 Replies)
Hi,
Could anyone help me to find soultion for the issue to send email attachment as read only.
I can change the file permission in Linux and can send the email attachment from Linux. But my requirment is user can read the attachment but should not modified it . even user save the attachment... (4 Replies)
a file is created on a daily basis in the name xyz_pqr_20071207.dat.i want to send the file as an attachment if the file contains more than 50 records.how can i write a script such that it will transmit the file after the file is created.i want to sed the file to say asdf@xyz.com.
please help me... (2 Replies)