Assuming you want to have the data formatted like
| Number | Car | ID | Cost |
| ------ | ---- | -- | ---- |
| #003 | BMW | 11 | 36 |
| #004 | Audi | 2 | 35 |
The csvlook command from csvkit does this for you, if you first insert the headers.
You may insert the headers by editing your file (or causing your data-generator command to emit them), adding a line saying Number:Car:ID:Cost at the start, or you may provide the header line on the fly:
$ { echo Number:Car:ID:Cost; cat file; } | csvlook
| Number | Car | ID | Cost |
| ------ | ---- | -- | ---- |
| #003 | BMW | 11 | 36 |
| #004 | Audi | 2 | 35 |
Above, the csvlook command detects that the data is a CSV document using : as its field delimiter (this could also be explicitly specified using -d :), and produces the formatted table.
Note that cat file may be replaced by any command producing the data as output.
The final output from csvlook is valid Markdown code which, on this site, renders like this:
| Number |
Car |
ID |
Cost |
| #003 |
BMW |
11 |
36 |
| #004 |
Audi |
2 |
35 |
Treating the input as CSV allows us to support fields containing quoted : characters:
$ cat file
#003:BMW:11:36
#004:Audi:2:35
#005:Saab:99:"1:50"
$ { echo Number:Car:ID:Cost; cat file; } | csvlook
| Number | Car | ID | Cost |
| ------ | ---- | -- | ---- |
| #003 | BMW | 11 | 36 |
| #004 | Audi | 2 | 35 |
| #005 | Saab | 99 | 1:50 |