我如何使用过滤器来显示如下内容:
echo "你好" |
H
e
l
l
o
t
h
e
r
e
Run Code Online (Sandbox Code Playgroud)
ter*_*don 11
这是一对夫妇:
fold
echo "Hello there" | fold -w 1
H
e
l
l
o
t
h
e
r
e
Run Code Online (Sandbox Code Playgroud)珀尔
echo "Hello there" | perl -pe 's/(.)/$1\n/g;'
H
e
l
l
o
t
h
e
r
e
Run Code Online (Sandbox Code Playgroud)您可以使用它sed
来执行此操作。它比 perl 轻一些,但仍然允许您使用正则表达式来表达您的内心愿望。
$ echo "Hello world" | sed -r 's/./&\n/g'
H
e
l
l
o
w
o
r
l
d
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
198 次 |
最近记录: |