shell语言处理多行合并一行问题

 刚处理问题时需要将 system_finger.txt中的两行合并起来中间以分号作分割符。

system_finger.txt内容为:
fc7:2.6.23.1
Fedora release 7 (Moonshine)

查找下资料知道用awk可以完成这项艰巨的任务。

awk '{if(NR%2==0){printf $0}else{printf "%s:",$0}}' > system_fingerprint.txt

cat  system_fingerprint.txt 看看

fc7:2.6.23.1:Fedora release 7 (Moonshine)

good !  

你可能感兴趣的:(shell,语言,处理,休闲)