0

I have file

cat demo.txt

servername
a
b
c
servername
d
f
c
servername
k
f
g

i want convert as below

servername servername servername
a            d         k
b            f         f
c            c         g

using shell. here servername are dynamic

0

1 Answer 1

4

pr -3T

pr -3T
servername              servername              servername
a                       d                       k
b                       f                       f
c                       c                       g

pr paginates or columnates data.

pr -3 will split and print three vertical columns. If more columns were needed, you can increase (or decrease) the count accordingly.

-T- -T, --omit-pagination omit page headers and trailers, eliminate any pagination by form feeds set in input files (Taken from man page)

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .