[CentOS] Script Output Format

Wed Dec 29 16:48:19 UTC 2010
Alejandro Rodriguez Luna <el_alexluna at yahoo.com.mx>

Hi all!

i'm just did a script that the output must be comma separated to be imported into a spreadsheet.

the output that i obteined was 

Date/Time,We. Active Threads,W. Total Threads,W. Worker Threads,Name
29-12-10/11:43:01,0,250,0,/FIM
,0,/mytest
,0,/mockofprod/financing/customercentre
,0,/mockofprod/financing/commercial/amt
,0,/account/orderstatus
,0,/activities

as you can see, the first row it's ok, but the second and third, etc etc, are not formated. any ideas of how can i achive this?

NOTE: the first three values are simple commands that i put in order, the fourth and fifth are from a file.

this is part of the code.


printf "%s,%d,%d" $DATE $WSAT $WSTT >> output.${STANZA}.txt

for i in `cat jlist.${STANZA}.txt`
do
  JUNCTION=${i}
  WSWJ=`pdadmin -a sec_master -p ${PASSWD} server task ${STANZA} show ${JUNCTION} | grep 'threads' | awk '{ print $4 }'`
  printf ",%d,%s\n" ${WSWJ} ${JUNCTION} >> output.${STANZA}.txt
done


----------------------------------

Alejandro Rodriguez Luna

Movil: 044-311-112-86-41

----------------------------------


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos/attachments/20101229/ddcfbd2d/attachment-0004.html>