For solving some problems in steganography, I need to look for end of images in hex
I am using
xxd image.jpeg|grep ffd9
it does return the line having ffd9 when it is in C and D columns
but the same does not return anything when it is in 9 and A columns
With GNU grep this will give you the byte-offsets of the EOI markers:
LC_ALL=C grep -oabUP "\xFF\xD9" image.jpeg
For reference: