档案'A':
LoadA 1
LoadA 1.5
LoadB 2
LoadB 2.5
LoadC 3
LoadC 3.5
档案'B':
LoadA 56%
LoadA 56.5%
LoadB 73%
LoadB 73.5%
LoadC 98%
LoadC 98.5%
档案'C':
LoadA 9999
LoadA 9999.5
LoadB 4567
LoadB 4567.5
LoadC 1234
LoadC 1234.5
输出文件:
LoadA 1 56% 9999
LoadA 1.5 56.5% 9999.5
LoadB 2 73% 4567
LoadB 2.5 73.5% 4567.5
LoadC 3 98% 1234
LoadC 3.5 98.5% 1234.5
如何使用sed,paste,join等基本bash工具生成上述输出文件。
答案 0 :(得分:1)
使用paste
和awk
即可:
paste fileA fileB fileC | awk -v OFS='\t' '{print $1, $2, $4, $6}'
LoadA 1 56% 9999
LoadA 1.5 56.5% 9999.5
LoadB 2 73% 4567
LoadB 2.5 73.5% 4567.5
LoadC 3 98% 1234
LoadC 3.5 98.5% 1234.5