海王  
http://www.shocr.com/linux-for-line-batch-replace-spaces-regular/
 

用三种解决方案来批量将换行改为空格,非常感谢柳城的帮助.

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}'

posted on 2011-01-11 17:41  海王  阅读(10228)  评论(0编辑  收藏  举报