This question actually asks the 'inverse' solution as the one here, namely I would like to wrap the long column (column 4) on multiple lines. In effect, the output should look like:
cat test.csv | column -s"," -t -c5
col1 col2 col3 col4 col5
1 2 3 longLineOfText 5
ThatIWantTo
InspectAndWould
LikeToWrap
(excuse the u.u.o.c. duplicated over here :) )
The solution would ideally :
- make use of standard *nix text processing utilities (e.g.
column
,paste
,pr
which usually are present on any modern Linux machine nowadays, usually coming from thecore-utils
package); - avoid
jq
as it is not necessarily present on every (production) system; - don't overheat the brain: yes... am looking mainly at you
awk
& co. gurus :). "Normal"awk / perl / sed
is fine. - as a special bonus , a solution using
vim
would be even more welcome (again, no brain smoke please), since that would allow for syntax-coloring as well.
The background: I want to be able to make sense of the output of docker history
, so as a last resort even some Go
Template-magic would suit, as would using jq
.
In extreme cases (if the benefits of ease-of-remembering-and-use outweigh the inconvenience of downloading a new utilty (preferably self-contained / static linked) utility on the server - is ok, or using json
processing commands (in which case using python
s json module would be preferred)
Thanks !
LE:
Please keep in mind, that docker
s output has the columns separated with several spaces, which unfortunately confuses most commands :(