Reconsider spacing of columns
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I have a file with the following format
1 1 1 0.02484183 57.2400000 24.6000000
2 1 2 -0.16091000 56.5200000 24.5600000
3 1 1 0.02484183 55.5700000 24.4900000
4 1 1 0.02484183 56.4400000 25.5100000
5 1 2 0.08638400 56.8900000 23.3300000
6 1 1 0.01376475 57.8900000 23.5200000
7 1 1 0.01376475 57.0600000 22.5200000
8 1 2 0.17612200 55.8800000 22.9700000
9 1 1 0.02042900 56.1600000 22.0400000
10 1 2 -0.34768900 55.9300000 24.0700000
11 1 1 0.07439383 55.5100000 25.0200000
12 1 1 0.07439383 55.4600000 23.7100000
13 1 1 0.07439383 57.0000000 24.2400000
14 1 2 0.02151800 54.4400000 22.8700000
15 1 1 0.08793975 54.5000000 22.4000000
I want instead to produce a file with the format below
1 1 1 0.02484183 57.2400000 24.6000000
2 1 2 -0.16091000 56.5200000 24.5600000
3 1 1 0.02484183 55.5700000 24.4900000
4 1 1 0.02484183 56.4400000 25.5100000
5 1 2 0.08638400 56.8900000 23.3300000
6 1 1 0.01376475 57.8900000 23.5200000
7 1 1 0.01376475 57.0600000 22.5200000
8 1 2 0.17612200 55.8800000 22.9700000
9 1 1 0.02042900 56.1600000 22.0400000
10 1 2 -0.34768900 55.9300000 24.0700000
11 1 1 0.07439383 55.5100000 25.0200000
12 1 1 0.07439383 55.4600000 23.7100000
13 1 1 0.07439383 57.0000000 24.2400000
14 1 2 0.02151800 54.4400000 22.8700000
15 1 1 0.08793975 54.5000000 22.4000000
awk text-formatting printf
add a comment |Â
up vote
1
down vote
favorite
I have a file with the following format
1 1 1 0.02484183 57.2400000 24.6000000
2 1 2 -0.16091000 56.5200000 24.5600000
3 1 1 0.02484183 55.5700000 24.4900000
4 1 1 0.02484183 56.4400000 25.5100000
5 1 2 0.08638400 56.8900000 23.3300000
6 1 1 0.01376475 57.8900000 23.5200000
7 1 1 0.01376475 57.0600000 22.5200000
8 1 2 0.17612200 55.8800000 22.9700000
9 1 1 0.02042900 56.1600000 22.0400000
10 1 2 -0.34768900 55.9300000 24.0700000
11 1 1 0.07439383 55.5100000 25.0200000
12 1 1 0.07439383 55.4600000 23.7100000
13 1 1 0.07439383 57.0000000 24.2400000
14 1 2 0.02151800 54.4400000 22.8700000
15 1 1 0.08793975 54.5000000 22.4000000
I want instead to produce a file with the format below
1 1 1 0.02484183 57.2400000 24.6000000
2 1 2 -0.16091000 56.5200000 24.5600000
3 1 1 0.02484183 55.5700000 24.4900000
4 1 1 0.02484183 56.4400000 25.5100000
5 1 2 0.08638400 56.8900000 23.3300000
6 1 1 0.01376475 57.8900000 23.5200000
7 1 1 0.01376475 57.0600000 22.5200000
8 1 2 0.17612200 55.8800000 22.9700000
9 1 1 0.02042900 56.1600000 22.0400000
10 1 2 -0.34768900 55.9300000 24.0700000
11 1 1 0.07439383 55.5100000 25.0200000
12 1 1 0.07439383 55.4600000 23.7100000
13 1 1 0.07439383 57.0000000 24.2400000
14 1 2 0.02151800 54.4400000 22.8700000
15 1 1 0.08793975 54.5000000 22.4000000
awk text-formatting printf
So instead of defining space with awk like this 'print $1" "$2" "$3"..' to define characters (or real numbers) for each column)
â Dimitris Mintis
Aug 11 at 16:54
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have a file with the following format
1 1 1 0.02484183 57.2400000 24.6000000
2 1 2 -0.16091000 56.5200000 24.5600000
3 1 1 0.02484183 55.5700000 24.4900000
4 1 1 0.02484183 56.4400000 25.5100000
5 1 2 0.08638400 56.8900000 23.3300000
6 1 1 0.01376475 57.8900000 23.5200000
7 1 1 0.01376475 57.0600000 22.5200000
8 1 2 0.17612200 55.8800000 22.9700000
9 1 1 0.02042900 56.1600000 22.0400000
10 1 2 -0.34768900 55.9300000 24.0700000
11 1 1 0.07439383 55.5100000 25.0200000
12 1 1 0.07439383 55.4600000 23.7100000
13 1 1 0.07439383 57.0000000 24.2400000
14 1 2 0.02151800 54.4400000 22.8700000
15 1 1 0.08793975 54.5000000 22.4000000
I want instead to produce a file with the format below
1 1 1 0.02484183 57.2400000 24.6000000
2 1 2 -0.16091000 56.5200000 24.5600000
3 1 1 0.02484183 55.5700000 24.4900000
4 1 1 0.02484183 56.4400000 25.5100000
5 1 2 0.08638400 56.8900000 23.3300000
6 1 1 0.01376475 57.8900000 23.5200000
7 1 1 0.01376475 57.0600000 22.5200000
8 1 2 0.17612200 55.8800000 22.9700000
9 1 1 0.02042900 56.1600000 22.0400000
10 1 2 -0.34768900 55.9300000 24.0700000
11 1 1 0.07439383 55.5100000 25.0200000
12 1 1 0.07439383 55.4600000 23.7100000
13 1 1 0.07439383 57.0000000 24.2400000
14 1 2 0.02151800 54.4400000 22.8700000
15 1 1 0.08793975 54.5000000 22.4000000
awk text-formatting printf
I have a file with the following format
1 1 1 0.02484183 57.2400000 24.6000000
2 1 2 -0.16091000 56.5200000 24.5600000
3 1 1 0.02484183 55.5700000 24.4900000
4 1 1 0.02484183 56.4400000 25.5100000
5 1 2 0.08638400 56.8900000 23.3300000
6 1 1 0.01376475 57.8900000 23.5200000
7 1 1 0.01376475 57.0600000 22.5200000
8 1 2 0.17612200 55.8800000 22.9700000
9 1 1 0.02042900 56.1600000 22.0400000
10 1 2 -0.34768900 55.9300000 24.0700000
11 1 1 0.07439383 55.5100000 25.0200000
12 1 1 0.07439383 55.4600000 23.7100000
13 1 1 0.07439383 57.0000000 24.2400000
14 1 2 0.02151800 54.4400000 22.8700000
15 1 1 0.08793975 54.5000000 22.4000000
I want instead to produce a file with the format below
1 1 1 0.02484183 57.2400000 24.6000000
2 1 2 -0.16091000 56.5200000 24.5600000
3 1 1 0.02484183 55.5700000 24.4900000
4 1 1 0.02484183 56.4400000 25.5100000
5 1 2 0.08638400 56.8900000 23.3300000
6 1 1 0.01376475 57.8900000 23.5200000
7 1 1 0.01376475 57.0600000 22.5200000
8 1 2 0.17612200 55.8800000 22.9700000
9 1 1 0.02042900 56.1600000 22.0400000
10 1 2 -0.34768900 55.9300000 24.0700000
11 1 1 0.07439383 55.5100000 25.0200000
12 1 1 0.07439383 55.4600000 23.7100000
13 1 1 0.07439383 57.0000000 24.2400000
14 1 2 0.02151800 54.4400000 22.8700000
15 1 1 0.08793975 54.5000000 22.4000000
awk text-formatting printf
awk text-formatting printf
edited Aug 11 at 18:23
Jeff Schaller
32.4k849110
32.4k849110
asked Aug 11 at 16:49
Dimitris Mintis
111
111
So instead of defining space with awk like this 'print $1" "$2" "$3"..' to define characters (or real numbers) for each column)
â Dimitris Mintis
Aug 11 at 16:54
add a comment |Â
So instead of defining space with awk like this 'print $1" "$2" "$3"..' to define characters (or real numbers) for each column)
â Dimitris Mintis
Aug 11 at 16:54
So instead of defining space with awk like this 'print $1" "$2" "$3"..' to define characters (or real numbers) for each column)
â Dimitris Mintis
Aug 11 at 16:54
So instead of defining space with awk like this 'print $1" "$2" "$3"..' to define characters (or real numbers) for each column)
â Dimitris Mintis
Aug 11 at 16:54
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
3
down vote
awk using printf+%f
Try this. By using printf with a width modified (e.g. %2d
, the field is padded as required). Similarly, % 2.8f
formats a floating point number here.
$ awk 'printf "%2d%7d%7d % 2.8f % 2.7f % 2.7fn",$1,$2,$3,$4,$5,$6' file
1 1 1 0.02484183 57.2400000 24.6000000
2 1 2 -0.16091000 56.5200000 24.5600000
3 1 1 0.02484183 55.5700000 24.4900000
4 1 1 0.02484183 56.4400000 25.5100000
5 1 2 0.08638400 56.8900000 23.3300000
6 1 1 0.01376475 57.8900000 23.5200000
7 1 1 0.01376475 57.0600000 22.5200000
8 1 2 0.17612200 55.8800000 22.9700000
9 1 1 0.02042900 56.1600000 22.0400000
10 1 2 -0.34768900 55.9300000 24.0700000
11 1 1 0.07439383 55.5100000 25.0200000
12 1 1 0.07439383 55.4600000 23.7100000
13 1 1 0.07439383 57.0000000 24.2400000
14 1 2 0.02151800 54.4400000 22.8700000
15 1 1 0.08793975 54.5000000 22.4000000
$
Try it online!
awk using printf+tabs
The tab (t) approach also suggested makes the code a lot cleaner, but it doesn't achieve the alignment quite as you request.
$ awk 'print $1"t"$2"t"$3"t"$4"t"$5"t"$6' file
1 1 1 0.02484183 57.2400000 24.6000000
2 1 2 -0.16091000 56.5200000 24.5600000
3 1 1 0.02484183 55.5700000 24.4900000
4 1 1 0.02484183 56.4400000 25.5100000
5 1 2 0.08638400 56.8900000 23.3300000
6 1 1 0.01376475 57.8900000 23.5200000
7 1 1 0.01376475 57.0600000 22.5200000
8 1 2 0.17612200 55.8800000 22.9700000
9 1 1 0.02042900 56.1600000 22.0400000
10 1 2 -0.34768900 55.9300000 24.0700000
Codeless version, column
Again, not quite the output you request, but simple to achieve using column
.
$ column -t file
1 1 1 0.02484183 57.2400000 24.6000000
2 1 2 -0.16091000 56.5200000 24.5600000
3 1 1 0.02484183 55.5700000 24.4900000
4 1 1 0.02484183 56.4400000 25.5100000
5 1 2 0.08638400 56.8900000 23.3300000
6 1 1 0.01376475 57.8900000 23.5200000
7 1 1 0.01376475 57.0600000 22.5200000
8 1 2 0.17612200 55.8800000 22.9700000
9 1 1 0.02042900 56.1600000 22.0400000
10 1 2 -0.34768900 55.9300000 24.0700000
11 1 1 0.07439383 55.5100000 25.0200000
12 1 1 0.07439383 55.4600000 23.7100000
13 1 1 0.07439383 57.0000000 24.2400000
14 1 2 0.02151800 54.4400000 22.8700000
15 1 1 0.08793975 54.5000000 22.4000000
$
1
awesome!!! I appreciate this a lot!!!
â Dimitris Mintis
Aug 11 at 17:42
add a comment |Â
up vote
1
down vote
Read the file with awk
and output the values with printf
.
awk ' printf ("%2dt%st%st%11st%st%sn", $1, $2, $3, $4, $5, $6); ' file
Adapt the printf format string as you need.
1
@steve The was just at
missing fromt
.
â RalfFriedl
Aug 11 at 20:10
1
@steve Of course, you are correct.
â RalfFriedl
Aug 11 at 22:07
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
awk using printf+%f
Try this. By using printf with a width modified (e.g. %2d
, the field is padded as required). Similarly, % 2.8f
formats a floating point number here.
$ awk 'printf "%2d%7d%7d % 2.8f % 2.7f % 2.7fn",$1,$2,$3,$4,$5,$6' file
1 1 1 0.02484183 57.2400000 24.6000000
2 1 2 -0.16091000 56.5200000 24.5600000
3 1 1 0.02484183 55.5700000 24.4900000
4 1 1 0.02484183 56.4400000 25.5100000
5 1 2 0.08638400 56.8900000 23.3300000
6 1 1 0.01376475 57.8900000 23.5200000
7 1 1 0.01376475 57.0600000 22.5200000
8 1 2 0.17612200 55.8800000 22.9700000
9 1 1 0.02042900 56.1600000 22.0400000
10 1 2 -0.34768900 55.9300000 24.0700000
11 1 1 0.07439383 55.5100000 25.0200000
12 1 1 0.07439383 55.4600000 23.7100000
13 1 1 0.07439383 57.0000000 24.2400000
14 1 2 0.02151800 54.4400000 22.8700000
15 1 1 0.08793975 54.5000000 22.4000000
$
Try it online!
awk using printf+tabs
The tab (t) approach also suggested makes the code a lot cleaner, but it doesn't achieve the alignment quite as you request.
$ awk 'print $1"t"$2"t"$3"t"$4"t"$5"t"$6' file
1 1 1 0.02484183 57.2400000 24.6000000
2 1 2 -0.16091000 56.5200000 24.5600000
3 1 1 0.02484183 55.5700000 24.4900000
4 1 1 0.02484183 56.4400000 25.5100000
5 1 2 0.08638400 56.8900000 23.3300000
6 1 1 0.01376475 57.8900000 23.5200000
7 1 1 0.01376475 57.0600000 22.5200000
8 1 2 0.17612200 55.8800000 22.9700000
9 1 1 0.02042900 56.1600000 22.0400000
10 1 2 -0.34768900 55.9300000 24.0700000
Codeless version, column
Again, not quite the output you request, but simple to achieve using column
.
$ column -t file
1 1 1 0.02484183 57.2400000 24.6000000
2 1 2 -0.16091000 56.5200000 24.5600000
3 1 1 0.02484183 55.5700000 24.4900000
4 1 1 0.02484183 56.4400000 25.5100000
5 1 2 0.08638400 56.8900000 23.3300000
6 1 1 0.01376475 57.8900000 23.5200000
7 1 1 0.01376475 57.0600000 22.5200000
8 1 2 0.17612200 55.8800000 22.9700000
9 1 1 0.02042900 56.1600000 22.0400000
10 1 2 -0.34768900 55.9300000 24.0700000
11 1 1 0.07439383 55.5100000 25.0200000
12 1 1 0.07439383 55.4600000 23.7100000
13 1 1 0.07439383 57.0000000 24.2400000
14 1 2 0.02151800 54.4400000 22.8700000
15 1 1 0.08793975 54.5000000 22.4000000
$
1
awesome!!! I appreciate this a lot!!!
â Dimitris Mintis
Aug 11 at 17:42
add a comment |Â
up vote
3
down vote
awk using printf+%f
Try this. By using printf with a width modified (e.g. %2d
, the field is padded as required). Similarly, % 2.8f
formats a floating point number here.
$ awk 'printf "%2d%7d%7d % 2.8f % 2.7f % 2.7fn",$1,$2,$3,$4,$5,$6' file
1 1 1 0.02484183 57.2400000 24.6000000
2 1 2 -0.16091000 56.5200000 24.5600000
3 1 1 0.02484183 55.5700000 24.4900000
4 1 1 0.02484183 56.4400000 25.5100000
5 1 2 0.08638400 56.8900000 23.3300000
6 1 1 0.01376475 57.8900000 23.5200000
7 1 1 0.01376475 57.0600000 22.5200000
8 1 2 0.17612200 55.8800000 22.9700000
9 1 1 0.02042900 56.1600000 22.0400000
10 1 2 -0.34768900 55.9300000 24.0700000
11 1 1 0.07439383 55.5100000 25.0200000
12 1 1 0.07439383 55.4600000 23.7100000
13 1 1 0.07439383 57.0000000 24.2400000
14 1 2 0.02151800 54.4400000 22.8700000
15 1 1 0.08793975 54.5000000 22.4000000
$
Try it online!
awk using printf+tabs
The tab (t) approach also suggested makes the code a lot cleaner, but it doesn't achieve the alignment quite as you request.
$ awk 'print $1"t"$2"t"$3"t"$4"t"$5"t"$6' file
1 1 1 0.02484183 57.2400000 24.6000000
2 1 2 -0.16091000 56.5200000 24.5600000
3 1 1 0.02484183 55.5700000 24.4900000
4 1 1 0.02484183 56.4400000 25.5100000
5 1 2 0.08638400 56.8900000 23.3300000
6 1 1 0.01376475 57.8900000 23.5200000
7 1 1 0.01376475 57.0600000 22.5200000
8 1 2 0.17612200 55.8800000 22.9700000
9 1 1 0.02042900 56.1600000 22.0400000
10 1 2 -0.34768900 55.9300000 24.0700000
Codeless version, column
Again, not quite the output you request, but simple to achieve using column
.
$ column -t file
1 1 1 0.02484183 57.2400000 24.6000000
2 1 2 -0.16091000 56.5200000 24.5600000
3 1 1 0.02484183 55.5700000 24.4900000
4 1 1 0.02484183 56.4400000 25.5100000
5 1 2 0.08638400 56.8900000 23.3300000
6 1 1 0.01376475 57.8900000 23.5200000
7 1 1 0.01376475 57.0600000 22.5200000
8 1 2 0.17612200 55.8800000 22.9700000
9 1 1 0.02042900 56.1600000 22.0400000
10 1 2 -0.34768900 55.9300000 24.0700000
11 1 1 0.07439383 55.5100000 25.0200000
12 1 1 0.07439383 55.4600000 23.7100000
13 1 1 0.07439383 57.0000000 24.2400000
14 1 2 0.02151800 54.4400000 22.8700000
15 1 1 0.08793975 54.5000000 22.4000000
$
1
awesome!!! I appreciate this a lot!!!
â Dimitris Mintis
Aug 11 at 17:42
add a comment |Â
up vote
3
down vote
up vote
3
down vote
awk using printf+%f
Try this. By using printf with a width modified (e.g. %2d
, the field is padded as required). Similarly, % 2.8f
formats a floating point number here.
$ awk 'printf "%2d%7d%7d % 2.8f % 2.7f % 2.7fn",$1,$2,$3,$4,$5,$6' file
1 1 1 0.02484183 57.2400000 24.6000000
2 1 2 -0.16091000 56.5200000 24.5600000
3 1 1 0.02484183 55.5700000 24.4900000
4 1 1 0.02484183 56.4400000 25.5100000
5 1 2 0.08638400 56.8900000 23.3300000
6 1 1 0.01376475 57.8900000 23.5200000
7 1 1 0.01376475 57.0600000 22.5200000
8 1 2 0.17612200 55.8800000 22.9700000
9 1 1 0.02042900 56.1600000 22.0400000
10 1 2 -0.34768900 55.9300000 24.0700000
11 1 1 0.07439383 55.5100000 25.0200000
12 1 1 0.07439383 55.4600000 23.7100000
13 1 1 0.07439383 57.0000000 24.2400000
14 1 2 0.02151800 54.4400000 22.8700000
15 1 1 0.08793975 54.5000000 22.4000000
$
Try it online!
awk using printf+tabs
The tab (t) approach also suggested makes the code a lot cleaner, but it doesn't achieve the alignment quite as you request.
$ awk 'print $1"t"$2"t"$3"t"$4"t"$5"t"$6' file
1 1 1 0.02484183 57.2400000 24.6000000
2 1 2 -0.16091000 56.5200000 24.5600000
3 1 1 0.02484183 55.5700000 24.4900000
4 1 1 0.02484183 56.4400000 25.5100000
5 1 2 0.08638400 56.8900000 23.3300000
6 1 1 0.01376475 57.8900000 23.5200000
7 1 1 0.01376475 57.0600000 22.5200000
8 1 2 0.17612200 55.8800000 22.9700000
9 1 1 0.02042900 56.1600000 22.0400000
10 1 2 -0.34768900 55.9300000 24.0700000
Codeless version, column
Again, not quite the output you request, but simple to achieve using column
.
$ column -t file
1 1 1 0.02484183 57.2400000 24.6000000
2 1 2 -0.16091000 56.5200000 24.5600000
3 1 1 0.02484183 55.5700000 24.4900000
4 1 1 0.02484183 56.4400000 25.5100000
5 1 2 0.08638400 56.8900000 23.3300000
6 1 1 0.01376475 57.8900000 23.5200000
7 1 1 0.01376475 57.0600000 22.5200000
8 1 2 0.17612200 55.8800000 22.9700000
9 1 1 0.02042900 56.1600000 22.0400000
10 1 2 -0.34768900 55.9300000 24.0700000
11 1 1 0.07439383 55.5100000 25.0200000
12 1 1 0.07439383 55.4600000 23.7100000
13 1 1 0.07439383 57.0000000 24.2400000
14 1 2 0.02151800 54.4400000 22.8700000
15 1 1 0.08793975 54.5000000 22.4000000
$
awk using printf+%f
Try this. By using printf with a width modified (e.g. %2d
, the field is padded as required). Similarly, % 2.8f
formats a floating point number here.
$ awk 'printf "%2d%7d%7d % 2.8f % 2.7f % 2.7fn",$1,$2,$3,$4,$5,$6' file
1 1 1 0.02484183 57.2400000 24.6000000
2 1 2 -0.16091000 56.5200000 24.5600000
3 1 1 0.02484183 55.5700000 24.4900000
4 1 1 0.02484183 56.4400000 25.5100000
5 1 2 0.08638400 56.8900000 23.3300000
6 1 1 0.01376475 57.8900000 23.5200000
7 1 1 0.01376475 57.0600000 22.5200000
8 1 2 0.17612200 55.8800000 22.9700000
9 1 1 0.02042900 56.1600000 22.0400000
10 1 2 -0.34768900 55.9300000 24.0700000
11 1 1 0.07439383 55.5100000 25.0200000
12 1 1 0.07439383 55.4600000 23.7100000
13 1 1 0.07439383 57.0000000 24.2400000
14 1 2 0.02151800 54.4400000 22.8700000
15 1 1 0.08793975 54.5000000 22.4000000
$
Try it online!
awk using printf+tabs
The tab (t) approach also suggested makes the code a lot cleaner, but it doesn't achieve the alignment quite as you request.
$ awk 'print $1"t"$2"t"$3"t"$4"t"$5"t"$6' file
1 1 1 0.02484183 57.2400000 24.6000000
2 1 2 -0.16091000 56.5200000 24.5600000
3 1 1 0.02484183 55.5700000 24.4900000
4 1 1 0.02484183 56.4400000 25.5100000
5 1 2 0.08638400 56.8900000 23.3300000
6 1 1 0.01376475 57.8900000 23.5200000
7 1 1 0.01376475 57.0600000 22.5200000
8 1 2 0.17612200 55.8800000 22.9700000
9 1 1 0.02042900 56.1600000 22.0400000
10 1 2 -0.34768900 55.9300000 24.0700000
Codeless version, column
Again, not quite the output you request, but simple to achieve using column
.
$ column -t file
1 1 1 0.02484183 57.2400000 24.6000000
2 1 2 -0.16091000 56.5200000 24.5600000
3 1 1 0.02484183 55.5700000 24.4900000
4 1 1 0.02484183 56.4400000 25.5100000
5 1 2 0.08638400 56.8900000 23.3300000
6 1 1 0.01376475 57.8900000 23.5200000
7 1 1 0.01376475 57.0600000 22.5200000
8 1 2 0.17612200 55.8800000 22.9700000
9 1 1 0.02042900 56.1600000 22.0400000
10 1 2 -0.34768900 55.9300000 24.0700000
11 1 1 0.07439383 55.5100000 25.0200000
12 1 1 0.07439383 55.4600000 23.7100000
13 1 1 0.07439383 57.0000000 24.2400000
14 1 2 0.02151800 54.4400000 22.8700000
15 1 1 0.08793975 54.5000000 22.4000000
$
edited Aug 11 at 17:34
answered Aug 11 at 17:28
steve
12.9k22149
12.9k22149
1
awesome!!! I appreciate this a lot!!!
â Dimitris Mintis
Aug 11 at 17:42
add a comment |Â
1
awesome!!! I appreciate this a lot!!!
â Dimitris Mintis
Aug 11 at 17:42
1
1
awesome!!! I appreciate this a lot!!!
â Dimitris Mintis
Aug 11 at 17:42
awesome!!! I appreciate this a lot!!!
â Dimitris Mintis
Aug 11 at 17:42
add a comment |Â
up vote
1
down vote
Read the file with awk
and output the values with printf
.
awk ' printf ("%2dt%st%st%11st%st%sn", $1, $2, $3, $4, $5, $6); ' file
Adapt the printf format string as you need.
1
@steve The was just at
missing fromt
.
â RalfFriedl
Aug 11 at 20:10
1
@steve Of course, you are correct.
â RalfFriedl
Aug 11 at 22:07
add a comment |Â
up vote
1
down vote
Read the file with awk
and output the values with printf
.
awk ' printf ("%2dt%st%st%11st%st%sn", $1, $2, $3, $4, $5, $6); ' file
Adapt the printf format string as you need.
1
@steve The was just at
missing fromt
.
â RalfFriedl
Aug 11 at 20:10
1
@steve Of course, you are correct.
â RalfFriedl
Aug 11 at 22:07
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Read the file with awk
and output the values with printf
.
awk ' printf ("%2dt%st%st%11st%st%sn", $1, $2, $3, $4, $5, $6); ' file
Adapt the printf format string as you need.
Read the file with awk
and output the values with printf
.
awk ' printf ("%2dt%st%st%11st%st%sn", $1, $2, $3, $4, $5, $6); ' file
Adapt the printf format string as you need.
edited Aug 11 at 22:07
answered Aug 11 at 16:58
RalfFriedl
3,6401522
3,6401522
1
@steve The was just at
missing fromt
.
â RalfFriedl
Aug 11 at 20:10
1
@steve Of course, you are correct.
â RalfFriedl
Aug 11 at 22:07
add a comment |Â
1
@steve The was just at
missing fromt
.
â RalfFriedl
Aug 11 at 20:10
1
@steve Of course, you are correct.
â RalfFriedl
Aug 11 at 22:07
1
1
@steve The was just a
t
missing from t
.â RalfFriedl
Aug 11 at 20:10
@steve The was just a
t
missing from t
.â RalfFriedl
Aug 11 at 20:10
1
1
@steve Of course, you are correct.
â RalfFriedl
Aug 11 at 22:07
@steve Of course, you are correct.
â RalfFriedl
Aug 11 at 22:07
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f462023%2freconsider-spacing-of-columns%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
So instead of defining space with awk like this 'print $1" "$2" "$3"..' to define characters (or real numbers) for each column)
â Dimitris Mintis
Aug 11 at 16:54