有两个文件,格式如下
app1,20,30,2,55
app2,23,44,56,58
app3,32,32,6,59
app1,25,37,24,59
app2,27,64,58,66
app3,39,72,9,70
对应位置相减后输出:
app1,5,7,22,4
app2,4,20,2,8
app3,7,40,3,11
用shell如何实现?
能用语言解决的为什么要用shell Python不是挺好的么
$ join file1 file2 -t, -j1 | awk -F, 'BEGIN{OFS = ","}{ print $1, $6-$2, $7-$3, $8-$4, $9-$5 }'
學這個用處非常小..除非你只能在沒有現代腳本解析器的機器工作