awk iterate over column code example Example: awk iterate over columns awk '{for(i=1; i<=NF; i++) {if($i=="dog") print $0,i}}' file