New answers tagged

1 vote
Accepted

handling columns with whitespaces

Sounds like all you need is whichever of these you prefer: sed 's/ /whatever/' file awk '{sub(/ /,"whatever")}1' file Change whatever to whatever string you want to replace that first blank ...
  • 27.2k
3 votes

Visually aligning columns of a CSV file

Using GNU awk for FPAT and a 2 pass approach: $ cat tst.awk BEGIN { FPAT = "([^,]*)|(\"([^\"]|\"\")*\")" OFS = ", " } NR==FNR { for ( i=1; i<...
  • 27.2k
7 votes

Visually aligning columns of a CSV file

A CSV file of this type: a, b, c, some stuff,"some, other, stuff", d, 2023-03-10 18:37:00<EOL> x, y, z, t, cool, thing, 2022-04-12 21:44:00<EOL> is ...
  • 181
6 votes
Accepted

Visually aligning columns of a CSV file

There are some double quoted fields containing text and having commas. Forget about simple text parsing then. Just get something that can parse complex CSV and let that do the pretty-printing. Miller ...

Top 50 recent answers are included