Adjust columns in a table
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I have this table which is messed up
DB Size_in_MB
foobar 11011.2
barfoo 4582.9
donkey 4220.8
shoryuken 555.9
hadouken 220.0
kong 214.8
super_mario_bros_p 211.1
there are unnecessary spaces between columns. I want to add |
and adjust the spaces between columns. I tried sed 's/t/|/g'
and sed 's/t/t|t/g'
but did not work
DB | Size_in_MB
foobar | 11011.2
barfoo | 4582.9
donkey | 4220.8
shoryuken | 555.9
hadouken | 220.0
kong | 214.8
super_mario_bros_p | 211.1
I want the table like this:
DB | Size_in_MB
foobar | 11011.2
barfoo | 4582.9
donkey | 4220.8
shoryuken | 555.9
hadouken | 220.0
kong | 214.8
super_mario_bros_p | 211.1
scripting text-formatting
New contributor
add a comment |Â
up vote
2
down vote
favorite
I have this table which is messed up
DB Size_in_MB
foobar 11011.2
barfoo 4582.9
donkey 4220.8
shoryuken 555.9
hadouken 220.0
kong 214.8
super_mario_bros_p 211.1
there are unnecessary spaces between columns. I want to add |
and adjust the spaces between columns. I tried sed 's/t/|/g'
and sed 's/t/t|t/g'
but did not work
DB | Size_in_MB
foobar | 11011.2
barfoo | 4582.9
donkey | 4220.8
shoryuken | 555.9
hadouken | 220.0
kong | 214.8
super_mario_bros_p | 211.1
I want the table like this:
DB | Size_in_MB
foobar | 11011.2
barfoo | 4582.9
donkey | 4220.8
shoryuken | 555.9
hadouken | 220.0
kong | 214.8
super_mario_bros_p | 211.1
scripting text-formatting
New contributor
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I have this table which is messed up
DB Size_in_MB
foobar 11011.2
barfoo 4582.9
donkey 4220.8
shoryuken 555.9
hadouken 220.0
kong 214.8
super_mario_bros_p 211.1
there are unnecessary spaces between columns. I want to add |
and adjust the spaces between columns. I tried sed 's/t/|/g'
and sed 's/t/t|t/g'
but did not work
DB | Size_in_MB
foobar | 11011.2
barfoo | 4582.9
donkey | 4220.8
shoryuken | 555.9
hadouken | 220.0
kong | 214.8
super_mario_bros_p | 211.1
I want the table like this:
DB | Size_in_MB
foobar | 11011.2
barfoo | 4582.9
donkey | 4220.8
shoryuken | 555.9
hadouken | 220.0
kong | 214.8
super_mario_bros_p | 211.1
scripting text-formatting
New contributor
I have this table which is messed up
DB Size_in_MB
foobar 11011.2
barfoo 4582.9
donkey 4220.8
shoryuken 555.9
hadouken 220.0
kong 214.8
super_mario_bros_p 211.1
there are unnecessary spaces between columns. I want to add |
and adjust the spaces between columns. I tried sed 's/t/|/g'
and sed 's/t/t|t/g'
but did not work
DB | Size_in_MB
foobar | 11011.2
barfoo | 4582.9
donkey | 4220.8
shoryuken | 555.9
hadouken | 220.0
kong | 214.8
super_mario_bros_p | 211.1
I want the table like this:
DB | Size_in_MB
foobar | 11011.2
barfoo | 4582.9
donkey | 4220.8
shoryuken | 555.9
hadouken | 220.0
kong | 214.8
super_mario_bros_p | 211.1
scripting text-formatting
scripting text-formatting
New contributor
New contributor
edited yesterday
Jeff Schaller
33.7k851113
33.7k851113
New contributor
asked yesterday
Suzie
162
162
New contributor
New contributor
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
5
down vote
accepted
Try the command column
as follows:
cat file | sed 's/t/,|,/g' | column -s ',' -t
DB | Size_in_MB
foobar | 11011.2
barfoo | 4582.9
donkey | 4220.8
shoryuken | 555.9
hadouken | 220.0
kong | 214.8
super_mario_bros_p | 211.1
thank you but this is still doesn't work. the columns are not adjusted!
â Suzie
yesterday
Hi @Suzie I just ran the command and the results as listed in my answer. Run the command on your original table!
â Goro
yesterday
@Goro: also ran the command but did not work for me either. For mesed 's/s+/,|,/g'
did the trick.
â Thomas
yesterday
1
Ah Ok my bad, it worked I was doing it on the second table. Thank you for help!
â Suzie
yesterday
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
accepted
Try the command column
as follows:
cat file | sed 's/t/,|,/g' | column -s ',' -t
DB | Size_in_MB
foobar | 11011.2
barfoo | 4582.9
donkey | 4220.8
shoryuken | 555.9
hadouken | 220.0
kong | 214.8
super_mario_bros_p | 211.1
thank you but this is still doesn't work. the columns are not adjusted!
â Suzie
yesterday
Hi @Suzie I just ran the command and the results as listed in my answer. Run the command on your original table!
â Goro
yesterday
@Goro: also ran the command but did not work for me either. For mesed 's/s+/,|,/g'
did the trick.
â Thomas
yesterday
1
Ah Ok my bad, it worked I was doing it on the second table. Thank you for help!
â Suzie
yesterday
add a comment |Â
up vote
5
down vote
accepted
Try the command column
as follows:
cat file | sed 's/t/,|,/g' | column -s ',' -t
DB | Size_in_MB
foobar | 11011.2
barfoo | 4582.9
donkey | 4220.8
shoryuken | 555.9
hadouken | 220.0
kong | 214.8
super_mario_bros_p | 211.1
thank you but this is still doesn't work. the columns are not adjusted!
â Suzie
yesterday
Hi @Suzie I just ran the command and the results as listed in my answer. Run the command on your original table!
â Goro
yesterday
@Goro: also ran the command but did not work for me either. For mesed 's/s+/,|,/g'
did the trick.
â Thomas
yesterday
1
Ah Ok my bad, it worked I was doing it on the second table. Thank you for help!
â Suzie
yesterday
add a comment |Â
up vote
5
down vote
accepted
up vote
5
down vote
accepted
Try the command column
as follows:
cat file | sed 's/t/,|,/g' | column -s ',' -t
DB | Size_in_MB
foobar | 11011.2
barfoo | 4582.9
donkey | 4220.8
shoryuken | 555.9
hadouken | 220.0
kong | 214.8
super_mario_bros_p | 211.1
Try the command column
as follows:
cat file | sed 's/t/,|,/g' | column -s ',' -t
DB | Size_in_MB
foobar | 11011.2
barfoo | 4582.9
donkey | 4220.8
shoryuken | 555.9
hadouken | 220.0
kong | 214.8
super_mario_bros_p | 211.1
answered yesterday
Goro
7,57753371
7,57753371
thank you but this is still doesn't work. the columns are not adjusted!
â Suzie
yesterday
Hi @Suzie I just ran the command and the results as listed in my answer. Run the command on your original table!
â Goro
yesterday
@Goro: also ran the command but did not work for me either. For mesed 's/s+/,|,/g'
did the trick.
â Thomas
yesterday
1
Ah Ok my bad, it worked I was doing it on the second table. Thank you for help!
â Suzie
yesterday
add a comment |Â
thank you but this is still doesn't work. the columns are not adjusted!
â Suzie
yesterday
Hi @Suzie I just ran the command and the results as listed in my answer. Run the command on your original table!
â Goro
yesterday
@Goro: also ran the command but did not work for me either. For mesed 's/s+/,|,/g'
did the trick.
â Thomas
yesterday
1
Ah Ok my bad, it worked I was doing it on the second table. Thank you for help!
â Suzie
yesterday
thank you but this is still doesn't work. the columns are not adjusted!
â Suzie
yesterday
thank you but this is still doesn't work. the columns are not adjusted!
â Suzie
yesterday
Hi @Suzie I just ran the command and the results as listed in my answer. Run the command on your original table!
â Goro
yesterday
Hi @Suzie I just ran the command and the results as listed in my answer. Run the command on your original table!
â Goro
yesterday
@Goro: also ran the command but did not work for me either. For me
sed 's/s+/,|,/g'
did the trick.â Thomas
yesterday
@Goro: also ran the command but did not work for me either. For me
sed 's/s+/,|,/g'
did the trick.â Thomas
yesterday
1
1
Ah Ok my bad, it worked I was doing it on the second table. Thank you for help!
â Suzie
yesterday
Ah Ok my bad, it worked I was doing it on the second table. Thank you for help!
â Suzie
yesterday
add a comment |Â
Suzie is a new contributor. Be nice, and check out our Code of Conduct.
Suzie is a new contributor. Be nice, and check out our Code of Conduct.
Suzie is a new contributor. Be nice, and check out our Code of Conduct.
Suzie is a new contributor. Be nice, and check out our Code of Conduct.
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%2f473775%2fadjust-columns-in-a-table%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