I have the following output
$ cat /proc/net/route
Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT
br-lan 03043836 C0A80101 0007 0 0 5 FFFFFFFF 0 0 0
br-lan C0A80100 00000000 0001 0 0 0 FFFFFF00 0 0 0
I use the awk to extract the line containing the Destination 03043836
and the Mask FFFFFFFF
and then I use the awk another time to display the first elment from the extracted line:
$ dest=03043836; mask=FFFFFFFF; va=1;
$ cat /proc/net/route | awk '$2=="'"$dest"'" && $8=="'"$mask"'"' | awk '{print $'"$va"'}'
br-lan
Now I want to gather both awk commands in only one awk command. How to do that?