Bash 使用sed命令

Bash 使用sed命令,bash,sed,solaris,Bash,Sed,Solaris,可能重复: 我有以下文件: test one My two Hi three 我需要一种使用cat和sed的方法来提供以下输出: testone Mytwo Hithree 如何在一个命令中实现这一点 文件“foo.txt”中包含文本的位置: cat foo.txt | sed -e 'N;s/\n//' 这应该是sed-e'$!Ns/\n/'?如果还有空行,请清除空行,否则无法使用

可能重复:

我有以下文件:

test 
one 
My
two 
Hi
three
我需要一种使用cat和sed的方法来提供以下输出:

testone
Mytwo
Hithree
如何在一个命令中实现这一点

文件“foo.txt”中包含文本的位置:

cat foo.txt | sed -e 'N;s/\n//'

这应该是
sed-e'$!Ns/\n/'
?如果还有空行,请清除空行,否则无法使用