How to output some data to different cells of an Excel File?
17,003
For "simple" columns like this, comma separated values will open nicely in excel.
awk 'BEGIN{ OFS=","; print "Hosts,Output,Status"}; NR > 1{print $1, $2, $3, $4, $5, $6, $7, $8, $9;}' input.txt > Output.csv
Related videos on Youtube
Author by
Koshur
Updated on September 18, 2022Comments
-
Koshur over 1 year
Example:
I have a file that has following data:
cvrta2100 Error 404 Fixed cvrta2111 Licensed Needs Fixing cvrta2123 Error 404 Fixed cvrta2333 Licensed Needs Fixing
I am using
awk
to print this output to an Excel file:awk 'BEGIN{ OFS="|"; print "Hosts|Output|Status"}; NR > 1{print $1, $2, $3, $4, $5, $6, $7, $8, $9;}' input.txt > Output.xls
The problem is - I am only able to get the results in a single cell i.e. "
cvrta2333 Licensed Needs Fixing
" is all printed in a single cell.My question: Is it possible to print each word Hosts, Output and Status in a different cell i.e.
cvrta2333
(One Cell)Licensed
(Next Cell)Needs Fixing
(Next Cell)