This is the hexadecimal output of an IPv6 TCP packet captured with tcpdump:
6000 0000 0018 0620 0000 0000
0000 0000 0000 0000 0000 0001 0000 0000
0000 0000 0000 0000 0000 0002 *0026 0026
0000 0001 0000 0002 {5}412 0065 0034 0000*
6162 6364
The packet itself is between the *s above. The {5} represents the packet length in 32-bit words (so it's 5 words long -- 20 bytes). I need to extract tcp header from this info using a bash/awk script, so the script needs to find the length byte and use it to know how much further to read. How can I do that in bash or awk?