Hello I'm trying to add column headers in my CSV file with awk in terminal.
Currently displays:
Michael, [email protected], Seattle, Washington, detail1, detail2, detail3
Desired format:
Name, Email, City, State, more1, more2, more3etc
Michael, [email protected], Seattle, Washington, detail1, detail2, detail3,
Have tried something like this, but I end up getting "Illegal Statement at Source line 2":
awk 'BEGIN {FS=",";OFS=","; print "Rating,Restaurant,Address,Landline,Mobile,Cuisine,Website,LatDD,LonDD"}
NR >1 {print ",",,,",",",", }' Restaurants.txt > Restaurants_newer.txt
,.BEGINuse print "Rating", "Restaurant" and so on, with each header as one string and the different headers separated by a comma. Replace the secondNR >1 ... ,}with{print }or just1.