awk - linux

Print lines where certain column matches string

cat logfile.log | awk -F "|" '$2 == " ERROR    " {print $0}'

# another example without the format separator
cat /proc/28464/status | awk '$1 == "VmPeak:" {print $2}'
        

Get column value of specific row

3rd column, 5th row of file
cat file | awk 'FNR == 5 {print $3}'
        

Reference bash variable in awk

awk -v ref="$REF" 'match($0, ref) {print $2}'