I have the output of a command that can list between 8 and 800 hosts.
I am trying to figure out how to break this into 3 or 4 columns.
Right now I am using "fmt | column" but the output is not as neat as I wish.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
Lets say you have something like this
host1 host2 host3 host..99
You can do something like this
awk 'NR%3?ORS=" ":ORS="\n"' hosts host1,host2,host3 host4,host5,host6 host7,host8,host9 host10,host11,host12 host13,host14,host15 host16,host17,host18 host19,host20,host21 host22,host23,host24 host25,host26,host27 host28,host29,host30 host31,host32,host33 host34,host35,host36 host37,host38,host39 host40,host41,host42 host43,host44,host45 host46,host47,host48 host49,host50,host51 host52,host53,host54 host55,host56,host57 host58,host59,host60 host61,host62,host63 host64,host65,host66 host67,host68,host69 host70,host71,host72 host73,host74,host75 host76,host77,host78 host79,host80,host81 host82,host83,host84 host85,host86,host87 host88,host89,host90 host91,host92,host93 host94,host95,host96 host97,host98,host99