fork download
  1. set -x
  2.  
  3. while read -r line || [[ -n "$line" ]]
  4. do
  5. log_date_str="$(awk '{gsub("\\[|\\]", "");print $1" "substr($2,1,length($2)-4)}' <<< "$line")"
  6. log_date="$(date -d "$log_date_str" +%s)"
  7. [[ $(($(date +%s)-$log_date)) -le 3600 ]] && echo "$line"
  8. done
Runtime error #stdin #stdout #stderr 0s 23336KB
stdin
[1/18/19 9:59:13:791 CST] <Extra text here...>
stdout
Standard output is empty
stderr
+ read -r line
+ [[ -n [1/18/19 9:59:13:791 CST] <Extra text here...> ]]
++ awk '{gsub("\\[|\\]", "");print $1" "substr($2,1,length($2)-4)}'
+ log_date_str='1/18/19 9:59:13'
++ date -d '1/18/19 9:59:13' +%s
+ log_date=1547805553
++ date +%s
+ [[ 27750 -le 3600 ]]
+ read -r line
+ [[ -n '' ]]