用三种解决方案来批量将换行改为空格,非常感谢柳城的帮助.
1.tr
cat gadgets.txt |tr "\n" " "
2.shell
for i in $(cat gadgets.txt);do echo -n "$i ";done
3.awk
cat gadgets.txt|awk '{printf "%s ",$1}'