我正在尝试复制 Hadoop 权威指南的示例,但不要指出它哪里出错了。
#!/usr/bin/env bash
for year in /home/*
do
echo -ne `basename $year .gz`"\t"
gunzip -c $year | awk '{temp = substr($0, 88, 5) + 0; q = substr($0, 93, 1); if (temp !=9999 && q ~ /[01459] && temp > max) max = temp }
END {print max}'
done
我得到的错误是
awk: cmd. line:1: {temp = substr($0, 88, 5) + 0; q = substr($0, 93, 1); if (temp !=9999 && q ~ /[01459] && temp > max) max = temp }
awk: cmd. line:1: ^ unexpected newline or end of string
awk: cmd. line:2: END {print max}
awk: cmd. line:2: ^ unexpected newline or end of string
还尝试了各种更改,但它不起作用。