New answers tagged columns
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 ...
- 15.5k
Top 50 recent answers are included
Related Tags
columns × 338text-processing × 181
awk × 126
shell-script × 34
sed × 33
text-formatting × 30
bash × 29
shell × 29
csv × 26
linux × 22
join × 19
scripting × 18
grep × 15
command-line × 14
cut × 13
merge × 13
sort × 12
files × 7
perl × 7
output × 6
printf × 6
numeric-data × 6
paste × 6
table × 6
terminal × 5