假设有个文件test.dat,其文件内容为:
line1
line2
line3
现在想将其转换为line1|line2|line3
cat test.dat | tr '\n' '|' | sed -e 's/|$/\n/'
就这么简单!
转载于:https://blog.51cto.com/feidandelion/438697
假设有个文件test.dat,其文件内容为:
line1
line2
line3
现在想将其转换为line1|line2|line3
cat test.dat | tr '\n' '|' | sed -e 's/|$/\n/'
就这么简单!
转载于:https://blog.51cto.com/feidandelion/438697