使用 sed 重复每一行

haa*_*ael 1 regex bash sed

我想使用 sed 复制输入的每一行。即当输入看起来像:

first
secod
third
fourth
...
Run Code Online (Sandbox Code Playgroud)

我希望输出看起来像:

first first
second second
third third
fourth fourth
... ...
Run Code Online (Sandbox Code Playgroud)

等等。

如果使用 sed 不可能做到这一点,那么您有什么建议?我更喜欢最简单的解决方案。

Chr*_*our 5

单程:

$ sed 's/.*/& &/' file
first first
second second
third third
fourth fourth
Run Code Online (Sandbox Code Playgroud)