I have two variables which contain multi-line information and I want to column them.
varA
returns
Aug 01
Aug 04
Aug 16
Aug 26
and varB
returns
04:25
07:28
03:39
10:06
if i print both variables, it returns
Aug01
Aug04
Aug16
Aug26
04:25
07:28
03:39
10:06
What I want to do is the following:
Aug01 04:25
Aug04 07:28
Aug16 03:39
Aug26 10:06
I'm new to using Linux and I would appreciate some advice.
Best Answer
Meet
paste
, part of the preinstalled GNU core utilities:paste
takes files and not variables as input, so I usedbash
Process Substitution and just printed the variable content withprintf
. The default delimiter between columns isTAB
, you can change that with the-d
option, e.g.paste -d" "
for a single space character. To learn more aboutpaste
have a look at the online manual or runinfo '(coreutils) paste invocation'
.