I have a txt file details.txt like this
name class school
a 1 sec
b 2 pri
c 3 hrsec
I want the values separated by space as diffenent columns.
so column 1 should be
name
a
b
c
column 2 should be
class
1
2
3
By the end I want the file to be a .csv file.
I used
awk -F " " ‘OFS="\t" {print $1,$2,$3 > ("output.csv")}’ details.txt
When I open the output file in excel all the values are in the same column. Please help with this. I am new to this. Thanks.
>Solution :
Use , (for the CSV(
awk -vOFS=, '{print $1,$2,$3}' details.txt > output.csv
and Excel would take the columns