8 required_fields=(byr iyr eyr hgt hcl ecl pid)
15 if [ $value -ge $min ] && [ $value -le $max ]; then
23 units=${value:$((${#value}-2)):2}
24 value=${value:0:$((${#value}-2))}
27 if [ $value -ge 59 ] && [ $value -le 76 ]; then
32 if [ $value -ge 150 ] && [ $value -le 193 ]; then
45 if [ ${value:0:1} != "#" ]; then
49 if [[ $value =~ /^[a-f0-9]{6}$/ ]]; then
59 amb|blu|brn|gry|grn|hzl|oth)
71 for x in ${!record[@]}; do
75 if ! ( check_year $value 1920 2002 ); then
80 if ! ( check_year $value 2010 2020 ); then
85 if ! ( check_year $value 2020 2030 ); then
90 if ! ( check_height $value ); then
95 if ! ( check_hair $value ); then
100 if ! ( check_eyes $value ); then
106 if [ ${#value} -ne 9 ]; then
120 while read -u 3 line; do
121 if [ "$line" = "" ]; then
127 cur_data="${cur_data}${seperator}$line"
131 # on the last line, if cur_data isn't empty, add that to the array
132 if [ "$cur_data" != "" ]; then
136 for (( i=0; i<${#data[@]}; i++ )); do
139 for field in $record; do
144 for field in ${required_fields[@]}; do
145 if ! [ ${kvp[$field]+a} ]; then
149 if ( check_data kvp ); then
150 valid_count=$((valid_count+1))
155 echo "$valid_count valid entries"