I am trying to to find all the files with a given extension and awk the results and append into all.txt.
set -xe
EXT="${1}"
TYPE="${2}"
COMP="${3}"
find -iname \*.${EXT} -print0 | xargs -0 ls -l --time-style="+%b %Y" | awk '{print $NF,$3,$5,$6,$7}' OFS="\t" > ${EXT}.txt
awk -vextension="${EXT}" -vfiletype="${TYPE}" -vcompress="${COMP}" -vOFS="\t" '{print $0, extension, filetype, compress}' < ${EXT}.txt >> all.txt
I am able to get the output from find command,
.fielename.gz Jason 197025960 May 2018
However, I am getting this syntax error from awk command,
+ awk -vextension=gzip -vfiletype=gz -vcompress=compressed '-vOFS=\t' '{print $0, extension, filetype, compress}'
awk: {print $0, extension, filetype, compress}
awk: ^ syntax error
awk
invocation.