Using unix2dos command in the below script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Using unix2dos command in the below script
# 1  
Old 01-06-2010
Bug Using unix2dos command in the below script

Hi,
Please help me in implemeting unix2dos command so that report output which comes as the attachment through mail is in the proper format

Am using uuencode fro attaching one report which is nothing but sql query output.

But when i receive the report through attachement and when it is opened the report is not displayed in proper format. Means if the query has 100 rows the mail attachment report displays the report in 2 rows itself.Please try to give the solution.

The script as mentioned below

Code:
par_file="/dlxfiles/BWParam/OPTIM/NPI.param"
conn_input_file="/dlxfiles/BWParam/OPTIM/all_cons.txt"

yyyymmdd=`date +%Y%m%d`

#SQL_OP="/dlxfiles/TgtFiles/OPTIM/audit_report_ci.txt"
CNT_FILE="/dlxfiles/TgtFiles/OPTIM/audit_report_ci_counts_$yyyymmdd.txt"

rm /dlxfiles/TgtFiles/OPTIM/audit_report_ci.doc
touch /dlxfiles/TgtFiles/OPTIM/audit_report_ci.doc

rm $CNT_FILE
touch $CNT_FILE
#chmod 777 $SQL_OP


for conn_name in `cat $conn_input_file`
do

echo "[C000134.WF:wflw_s_m_Load_NPI_AUDIT.ST:s_m_Load_NPI_AUDIT]" > $par_file
echo "\$DBConnection_Source"=$conn_name>> $par_file
DB_NM=`echo $conn_name | cut -d "_" -f2`

echo "\$\$DBNAME=$DB_NM">>$par_file
echo "\$DBConnection_Target=ADDRLBL_CID1_ETLUSER">> $par_file
echo "\$PMBadFile=/dlxfiles/BadFiles/OPTIM/s_m_Load_NPI_AUDIT.bad">>$par_file
echo "\$PMSessionLogFile=/dlxfiles/SessLogs/OPTIM/s_m_Load_NPI_AUDIT.log">>$par_file
echo "\$PMWorkflowLogDir=/dlxfiles/WorkflowLogs/OPTIM/wflw_s_s_m_Load_NPI_AUDIT.log">>$par_file

Sq_op_file="/dlxfiles/TgtFiles/OPTIM/audit_report_ci_"${DB_NM}"_$yyyymmdd.txt"
echo "#!/usr/bin/sh" >  /dlxfiles/TgtFiles/OPTIM/sql_op.sh
echo "SQL_OP="${Sq_op_file} >> /dlxfiles/TgtFiles/OPTIM/sql_op.sh
echo "export $SQL_OP;" >>  /dlxfiles/TgtFiles/OPTIM/sql_op.sh

. /dlxfiles/Scripts/SHARED/run_infa_workflow.sh C000134 wflw_s_m_Load_NPI_AUDIT

cnt=`cat $Sq_op_file | grep ${DB_NM} |  wc -l`
echo "Total matches found for ${DB_NM}: "$cnt >>$CNT_FILE

uuencode $Sq_op_file $Sq_op_file >> /dlxfiles/TgtFiles/OPTIM/audit_report_ci.doc

done

mailx -s 'Matches' xxx@x.com<  /dlxfiles/TgtFiles/OPTIM/audit_report_ci.doc


Last edited by vbe; 01-06-2010 at 05:59 AM.. Reason: rm buggy URL and tags...
# 2  
Old 01-06-2010
To convert a unix file to a file in dos format you can do something like:

Code:
awk '{printf "%s\r\n", $0}' unixfile > dosfile

# 3  
Old 01-06-2010
unix2dos is the exist command.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execute ssh command with additional terminal command to any remote user not working script

Hello i am having an issue with bash script and this is the code now=$(cat hosts1.txt | awk '{print $2;}') while read n ;do ssh root@$now 'useradd test1; echo -e "test1\ntest1" | passwd test1 && echo "test1 ALL=(ALL:ALL) ALL" >> /etc/sudoers' When i execute only part with cat, it... (8 Replies)
Discussion started by: tomislav91
8 Replies

2. Shell Programming and Scripting

Script exits when using UNIX2dos / dos2UNIX

I'm not sure why but my script quits automatically at the point where unix2dos / dos2unix command is used. :confused::confused::confused: How do a fix it? LOG_FILE=MADDY.txt unix2dos ${LOG_FILE} exec 2> $LOG_FILE 1>&2 echo ${LOG_FILE} The script exists after the below... (3 Replies)
Discussion started by: machomaddy
3 Replies

3. UNIX for Dummies Questions & Answers

Shell script not working but command works in command prompt

Hi everyone I have a problem with my script If I try directly this command /usr/bin/nice -n 19 mysqldump -u root --password="******" wiki_schneider -c | nice -n 19 gzip -9 > /point_de_montage/$(date '+%Y%m%d')-wiki-db.sql.gz It works But if I simply add this command in a script and... (8 Replies)
Discussion started by: picemma
8 Replies

4. UNIX for Dummies Questions & Answers

Set Command to output a log of every command executed in the script

Hi Guys, I like to output every command executed in the script to a file. I have tried set -x which does the same. But it is not giving the logs of the child script which is being called from my script. Is there any parameters in the Set command or someother way where i can see the log... (2 Replies)
Discussion started by: mac4rfree
2 Replies

5. Shell Programming and Scripting

SH script, variable built command fails, but works at command line

I am working with a sh script on a solaris 9 zone (sol 10 host) that grabs information to build the configuration command line. the variables Build64, SSLopt, CONFIGopt, and CC are populated in the script. the script includes CC=`which gcc` CONFIGopt=' --prefix=/ --exec-prefix=/usr... (8 Replies)
Discussion started by: oly_r
8 Replies

6. Shell Programming and Scripting

When i am trying to execute export command within a shell script it is saying command not found.

I am running the export command within a view to use that value inside my build script. But while executing it it is saying "export command not found" My code is as follows: -------------------------- #!/bin/sh user="test" DIR="/bldtmp/"$user VIEW="test.view1" echo "TMPDIR before export... (4 Replies)
Discussion started by: dchoudhury
4 Replies

7. Shell Programming and Scripting

unix2dos?

HI there ! can you please explain me about "unix2does" command like >> when we used ? what it does ? ... (3 Replies)
Discussion started by: sravan008
3 Replies

8. Shell Programming and Scripting

Need help! command working ok when executed in command line, but fails when run inside a script!

Hi everyone, when executing this command in unix: echo "WM7 Fatal Alerts:", $(cat query1.txt) > a.csvIt works fine, but running this command in a shell script gives an error saying that there's a syntax error. here is content of my script: tdbsrvr$ vi hc.sh "hc.sh" 22 lines, 509... (4 Replies)
Discussion started by: 4dirk1
4 Replies

9. Shell Programming and Scripting

can anyone help with shell script command about searching word with grep command?

i want to search in the current directory all the files that contain one word for example "hello" i want to achieve it with the grep command but not with the grep * (2 Replies)
Discussion started by: aintour
2 Replies

10. Windows & DOS: Issues & Discussions

unix script and unix2dos conversion

Hi, I am a newbie and do not have much experience using unix. But I have been trying to understand it. I found the following unix script typeset -i n=0 while do sleep 5 echo "${n}:Fluent is running...." n=${n}+1 done I have the following doubts: 1) In the first line - I am aware... (1 Reply)
Discussion started by: karthiksrao
1 Replies
Login or Register to Ask a Question