rammaghenthar
asked on
how to get all vmstat output file in Excel file (each line in seperate column)
Hi
I have following script to get vmstat output . I want each column of output in seperate column of Excel file. I have added .xls extension along with output file and checked the file . It was showing each full line per one row which format I don't need? I think some seperator need to introduce in the script? any help on this please?
Script file
####### cat /backup/vmstat/vmstat_col. ksh
##This is to collect the vmstat output
#/bin/ksh
/usr/bin/vmstat 60 1440 > /backup/vmstat/vmstat.`dat e +%d`
Cron entry
2 0 * * * /backup/vmstat/vmstat_col. ksh >/dev/null 2>&1
I have attached current output file for reference
vmstat.02.txt
I have following script to get vmstat output . I want each column of output in seperate column of Excel file. I have added .xls extension along with output file and checked the file . It was showing each full line per one row which format I don't need? I think some seperator need to introduce in the script? any help on this please?
Script file
####### cat /backup/vmstat/vmstat_col.
##This is to collect the vmstat output
#/bin/ksh
/usr/bin/vmstat 60 1440 > /backup/vmstat/vmstat.`dat
Cron entry
2 0 * * * /backup/vmstat/vmstat_col.
I have attached current output file for reference
vmstat.02.txt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Woolmilkporcji,
Let me work on it and come back to you
Let me work on it and come back to you
From your file, I can see that it is space delimited. If you have sed, you can issue command like
sed 's/^ *//;s/ */,/g' vmstat.02.txt > vmstat.02.csv
Or using perl
perl -pe 's/^\s+//;s/\s+/,/g' vmstat.02.txt > vmstat.02.csv