new_retain.txt
2017-01-01|121419|17844
2017-01-02|111997|14747
2017-01-03|98559|13898
active.txt
2017-01-01|4552854
2017-01-02|4254646
2017-01-03|3980417
awk '{if(NR==FNR){a[FNR]=$1;}else{print $1 "|" a[FNR]}}' new_retain.txt active.txt > new.txt
命令执行完成后,new.txt内容如下
2017-01-01|4552854|2017-01-01|121419|17844
2017-01-02|4254646|2017-01-02|111997|14747
2017-01-03|3980417|2017-01-03|98559|13898