This script:
- specifies the delimiter as a regex
- filters input line based on a regex ( regex right after the first single quote)
- cycles through fields
- tests a field against a regex (if block in the loop)
gawk -F"[=\x01]" '/35=AE.*150=F/ { for (i=1; i<=NF; i=i+2) { if ($i ~/^(52|55|32|31|1117|1121|782|785)$/) { printf "%s,",$(i+1)} } printf "\n" }' file_to_parse.log
My LinkedIn profile