Grep output formating for asterisk question?

I will take any help I can get on this topic.

I am trying to get the output of this into anything other than an email filled with numbers, a .csv would be nice. I have tried many iterations piping to awk etc… but I clearly lack the solid knowledge to pull this simple task off. Any help is appreciated, pointing to any learning materials is also appreciated.

tn1=$(asterisk -r -x “sip show peers” | grep ^XXX )
echo $tn1 >> /tmp/emailmessage.txt
SUBJECT=“Here is the Information"
EMAIL=“Blah blah.com"
EMAILMESSAGE=”/tmp/emailmessage.txt”
/bin/mail -s “$SUBJECT” “$EMAIL” < $EMAILMESSAGE
rm -f /tmp/emailmessage.txt

perl