2015-10-26 184 views

回答

2

您可以設置記錄分隔不了了之:

$ cat file 
tbname id department 
xyz 20 cic 
1-0 xyz 21 csp 
xyz 22 cpz 
abc 25 cis 
abc 26 cta 
abc 27 tec 

$ awk -v RS= '{gsub("\n1-0", " 1-0")}1' file 
tbname id department 
xyz 20 cic 1-0 xyz 21 csp 
xyz 22 cpz 
abc 25 cis 
abc 26 cta 
abc 27 tec 
+1

完美!非常感謝! – verlager

相關問題