最佳答案
如果我运行命令cat file | grep pattern,我会得到很多行输出。如何将所有行连接成一行,有效地将每个"\n"替换为"\" "(以"结尾,后面跟着空格)?
cat file | grep pattern | xargs sed s/\n/ /g
对我不起作用