热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

无法通过Zsh在两列中回显a-z-Unabletoechoa-zintwocolumnsbyZsh

Ineedtoprintthefollowingsequenceforillustrationpurposesintwocolumns我需要在两列中打印以下序列以用于说明目的

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

我需要在两列中打印以下序列以用于说明目的

a-z

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

它具有从a到z的字母表,因此它们是13个字符的列。

How can you echo the characters from a to z into two columns?

如何将a到z中的字符回显到两列?

3 个解决方案

#1


Better solutions exist, I'm sure, but I'll give it a shot:

我确信存在更好的解决方案,但我会试一试:

$ 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


Very nice Stephan,

非常好的斯蒂芬,

How about avoiding to type a through z with a loop?

如何避免用循环键入a到z?

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

#3


Your question did not specify how to distribute the characters in the two coloumns, so here is an alternative 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>

推荐阅读
author-avatar
huangyong黄勇_513
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有