Im trying to take data from a cvs file and display column heading names every 20lines or so.
file.cvs | post.sh
want it to look likeCode:#!/bin/bash while read y; do printf "Year\t%s\Eng. Disp.\t%sCyl.\t%sCity FE\t%sHwy FE\t%sModel" #heading awk -F ":" '{printf "%s\t%s\t%s\t%s\t%s\t%s\n", $1, $4, $5, $6, $7, $2}' #data done
Year Eng. Disp. Cyl. City FE Hwy FE Model
2012 1.5 6 42 45 BMW
2012 1.5 6 42 45 BMW
2012 1.5 6 42 45 BMW
2012 1.5 6 42 45 BMW
2012 1.5 6 42 45 BMW
2012 1.5 6 42 45 BMW
2012 1.5 6 42 45 BMW
2012 1.5 6 42 45 BMW
2012 1.5 6 42 45 BMW
2012 1.5 6 42 45 BMW
2012 1.5 6 42 45 BMW
...
Year Eng. Disp. Cyl. City FE Hwy FE Model
2012 1.5 6 42 45 BMW

Reply With Quote

