I have a csv file with following content.
"TELUS","Vancouver Canada","67.151","0.325","0","63247942","64210661","768241424","858087937"
"TELUS","Vancouver Canada","7.151","0.325","0","63247942","64210661","768241424","858087937"
With the help of awk, I have successfully parsing them to readable format.
awk -F, '{gsub(/"/, ""); printf "| %-11s | %-17s | %.1f %-6s | %.1f %-6s | %.1f %-6s | %.1f %-5.16s |\n", $1, $2, $7/125000, "MB/s", $6/125000, "MB/s", ($8+$9)/(1000*1000*1000), "GB", $3, "ms" }'
Return this
| TELUS | Vancouver Canada | 513.7 MB/s | 506.0 MB/s | 1.6 GB | 67.2 ms |
| TELUS | Vancouver Canada | 513.7 MB/s | 506.0 MB/s | 1.6 GB | 7.2 ms |
But as you can see the space is not equal on latency field. I want it to be like this.
| TELUS | Vancouver Canada | 513.7 MB/s | 506.0 MB/s | 1.6 GB | 67.2 ms |
| TELUS | Vancouver Canada | 513.7 MB/s | 506.0 MB/s | 1.6 GB | 7.2 ms |
| TELUS | Vancouver Canada | 513.7 MB/s | 506.0 MB/s | 1.6 GB | 947.2 ms |
| TELUS | Vancouver Canada | 513.7 MB/s | 506.0 MB/s | 1.6 GB | 7241.2 ms |
I'm putting two extra field at above, the point is I want to keep the column spacing intact no matter how large the latency is. How to do this?