Shell script for CSV conversion

thanks for allowing me join your forum
i have an output of linux command "who"
which provides following details.....

CURRENT USER/ACCT INFO
17:31:36 up 4:49, 4 users, load average: 0.03, 0.04, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root :0 - 12:59 ?xdm? 4:54 0.02s /bin/sh /usr/bi
root pts/0 :0 12:59 4:31m 0.00s 1:20 kded [kdeinit]
root pts/1 :0.0 16:18 1.00s 0.00s 0.00s -bash
root pts/2 :0.0 16:25 49.00s 0.02s 0.00s bash

This output i saved into a file named WHO.log

Now how to covert this output into CSV format so that i can export it into some database-------
using some bash script!!!!!!!!!!!!!!!!

any suggestion in this regard is greatly appreciated
thanks in advance

sed 's/  */,/g' WHO.log
1 Like