Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to extract version number form binary file using awk

Tags:

regex

awk

I had tried to extract version number from a binary file.
The version number is after this string 'VeRsIoN_StRiNg'.
But how to find it using awk and print the next character I can't find out.

Someone ther can help?

/Lasse

like image 867
Lasse Skov Avatar asked Nov 26 '25 09:11

Lasse Skov


1 Answers

Do you strictly need to use awk? This seems like a better usecase for grep --binary-files=text -o 'VeRsIoN_StRiNg.' file | grep -o '.$'.

I'm not entirely sure how well a stream editor like awk will actually work with a binary file. If this is part of a larger awk script, you probably want to call the above grep formula from awk.

like image 106
jkerian Avatar answered Nov 28 '25 22:11

jkerian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!