Unable to echo az in two columns over Zsh

I need to print the following sequence for illustration in two columns

a-z

      

which has alphabets a through z such that they are in 13-character columns.

How can you send characters a through z in two columns?

+1


a source to share


3 answers


I have better solutions, but I'll give it a chance:



$ echo "abcdefghijklmnopqrstuvwxyz" | sed -e 's/\(.\)\(.\)/\1 \2\n/g'
a b
c d
e f
g h
i j
k l
m n
o p
q r
s t
u v
w x
y z

      

+2


a source


Very handsome Stefan,

How about avoiding typing a through z with a loop?



for i in {a..z}; do echo -n $i; done | sed -e 's/\(.\)\(.\)/\1 \2\n/g'

      

+3


a source


Your question doesn't indicate how to distribute characters across two columns, so here's an alternate answer:

prompt> paste <(echo "abcdefghijklm" | sed 's/\(.\)/\1\n/g' ) <(echo "nopqrstuvwxyz" | sed 's/\(.\)/\1\n/g')
a       n
b       o
c       p
d       q
e       r
f       s
g       t
h       u
i       v
j       w
k       x
l       y
m       z

prompt>

      

0


a source







All Articles