Awk previous day -
for reason can not work? want compare previous day , current days file.
awk 'fnr==nr{a[nr]=$2;next}{print $1,$2-a[fnr]}' router_evi_`(strftime("%y-%m-%d", systime()-86400))`.txt router_evi_`(date +"%y-%m-%d")`.txt > temp_plus_minus.txt
thanks
you confused awk script , shell's $(..)
or
`...`
the command gave is:
awk '....' foo_`(awkcode)`.txt bar_`(shell cmd)`.txt ^ ---problem----------|
this won't work. since cannot let shell interpret , execute awk code. should write shell command/code in backticks. or this:
foo_$(awk 'begin{print strftime("%y-%m-%d", systime()-86400)}').txt
it better getting 2 filenames in variables first(if dynamic), , call awk script. making 1 line not best solution.
Comments
Post a Comment