我有这个 awk 命令,我需要在其中放入一个日期变量。我确定我在某处遗漏了一些语法。有没有高手可以帮帮我?基本上,我需要根据脚本运行的时间来改变日期。
date=$(date --date="1 month ago" +"%d-%b-%Y")
wget -qO - http://*********/users.csv > users
awk 'NR==1 {print "Primary Comments,Customer Account Number,Transaction Date,Service Description,Quantity,Unit,Price,Service Category,PI\x27sName,Purchaser\x27s Last Name,Short Contributing Center Name,Resource Name,Line Item Assistant,Line Item Comments"}
FNR==NR {S[$1]=$2; P[$1]=$3; next}
$1 in S {print "Bruker 500 NMR",P[$1],date,"500 MHz",$2/60,"Hour","5","500 MHz",S[$1],$1,"","501 NMR","","" }
' FS="," OFS="," OFMT="%.2f" $date users FS=" " wtmp > billing-$inst-$date.csv