美文网首页我爱编程
shell下文件内容拼接,用逗号分隔

shell下文件内容拼接,用逗号分隔

作者: 夜空最亮的9星 | 来源:发表于2018-08-09 06:52 被阅读13次
[root@node1 ~]# cat tableName.txt 
hello
hadoop
spark
mapreduce
storm
python

[root@node1 ~]# 

要达到的效果
hello,hadoop,spark,mapreduce,storm,python

[root@node1 ~]#  echo `(cat tableName.txt)` | sed 's/ /,/g'
hello,hadoop,spark,mapreduce,storm,python
[root@node1 ~]# 
 echo `(cat tableName.txt)` | sed 's/ /,/g'

相关文章

网友评论

    本文标题:shell下文件内容拼接,用逗号分隔

    本文链接:https://www.haomeiwen.com/subject/omofbftx.html