I have the a bunch of text that is represented similar to xml.
<File>
<abc1>
<Hex>
<item>
<data>AB CD 34 43</data>
</item>
</Hex>
</abc1>
</File>
I use an application (ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, not stripped) which takes a file as an argument and decodes it.
I can successfully run:
./application /tmp/file and it decodes correctly
I can also capture everything up to and including the line that contains the hex below (this works well, but of course, cannot enter in data everything into file and then run it - need to do it with a variable dynamically:
./application /tmp/file | sed '/AB CD 34 43/q'
But what I am unable to do is pass a variable instead of the hex string
./application /tmp/file | sed '/`echo -n "$value"`/q'
I don't mind what I use, sed/awk/grep.
My main aim is to extract everything up to the hex address then run another command to copy the same in the other direction, that I am left with mostly one complete "frame" if you will. Then I can just tail it for the frame size so it contains just one complete frame.