给定以下文件:
foo bar baz
this and that
然后我可以用 ed(1) 轻松通过全局替换“展开”这些行:
g/ /s//\
/g
其结果为:
foo
bar
baz
this
and
that
但是,有什么方法可以平滑地“折线”呢?
我不能在习语中使用\n
或模式。目前我使用以下方法:\<newline>
g/re/s
- 插入空格。
- 加入。
1
+,++s/^/ /
--,.jp
++,+++s/^/ /
--,.jp
,p
找回:
foo bar baz
this and that
但它非常笨重,我想知道是否有更好的方法!