examlpe files:
aaa.txt;bbb.txt; ccc.txt
cat filename | tr '; ' '\n'|sed 's/[ ]//g'
output:
aaa.txt bbb.txt ccc.txt
**sed 's/[ ]//g'消除space
2. 转换列到行
假设有个文件test.dat,其文件内容为:
line1
line2
line3
现在想将其转换为line1|line2|line3
cat test.dat | tr '\n' '|' | sed -e 's/|$/\n/'