Follow

In Bash how do I prettyfy as CVS so that instead of:
value1:value2
newvalue1:newvalue2

it becomes:

value1 : value2
newvalue1 : newvalue2

· · Web · 1 · 0 · 0
@matrix but you could do a simple substitution on the output (: -> ' : ') even if it's kludgey
@matrix @takao
I have found this question which might work here:
https://askubuntu.com/q/923396

You can get the length of the longest value for the first column in a for loop which would look something like the picture. And then do the same for the second column. In this case you would have to separate the input into two variables and go through both of them.

The think that I'm not sure about is whether the printf in the link would work for the second column aswell or just for the first one.
Sign in to participate in the conversation
Game Liberty Mastodon

Mainly gaming/nerd instance for people who value free speech. Everyone is welcome.