將一列數據用逗號隔開合併成一行數據

1bash

2ide

3it

4class

5test

6sed

7di

8view

9vi

10while


#!/bin/bash

for i in `seq 1 10`;do echo $i;done > ./test.txt

while read line;do var="$var,$line";done < test.txt

echo $var|sed 's/^,//g;s/,$//g'


1,2,3,4,5,6,7,8,9,10

相關文章
相關標籤/搜索