$ awk 'function get(dir,file,line){cmd="wc -l "dir"/"file;cmd|getline line;close(cmd);return(line+0)}BEGIN{FS=OFS=","}{if(!p){print;if($1=="filename")p=1;next}print $1,$2,get($sendpath,$1"*"),get(receivepath,$1".csv")}' read.csv
---------------------------------------
$./test.sh 執(zhí)行之后提示
wc: /A00001*: file or directory is not exist
wc: /A00001.csv: file or directory is not exist
wc: /A00002*: file or directory is not exist
wc: /A00002.csv: file or directory is not exist
wc: /A00003*: file or directory is not exist
wc: /A00003.csv: file or directory is not exist
-----------------------------------------------------------