wqdq
wqdqgrhehr
cnkzjncicoajc
hello space
oejwfoiwejfow
wqodojw
more spaces
more
Run Code Online (Sandbox Code Playgroud)
这是我的文件,我想用sed:
-wqdq
-wqdqgrhehr
-cnkzjncicoajc
-hello space
----oejwfoiwejfow
----wqodojw
----more spaces
----more
----
-
--
Run Code Online (Sandbox Code Playgroud)
我必须使用循环来制作它还是存在任何不同的方法?我试过这个:
user:~$ sed -n '
: loop
s/^ /-/
s/[^-] /-/p
t loop' spaces
Run Code Online (Sandbox Code Playgroud)