将多行数据以',' 进行分隔

[root@VM-52-133-centos opt]# cat idList.txt
102952000
102952199
102959860
102967560
102975106
102982724
102990453
102998202
103005971
[root@VM-52-133-centos opt]# cat idList.txt|awk '{if(NR==1){printf("%d",$0)}else{printf(",%d", $0)}}'
102952000,102952199,102959860,102967560,102975106,102982724,102990453,102998202,103005971
原文地址:https://www.cnblogs.com/netflix/p/15393925.html