vendredi 15 juillet 2016

grep a specific value when the matching criteria happens twice in the line


There are two lengths in the following line. I want to extract the value 46 and add 16 to it.

1466352405.455975 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto UDP (17), length 46) 192.168.52.53.32769 > 192.168.52.54.9600: UDP, length 18

I tried grep 'slength' | cut -d: -f1 but it doesn't give the correct result. I expect to obtain 46 and add 16 to it. So final value should be 64.

Thanks


Aucun commentaire:

Enregistrer un commentaire