I have the following command which works ok but I would like to add a further variable in somehow:
#!/bin/bash
x=40000
until [ $x = "180000" ]; do
dd bs=1 if=static.file of=extracted${x}.file skip=12345 count=$x;
first_ten=$(hexdump -e '1/1 "%.2X"' "extracted${x}.file" | head -c 10);
if [ "$first_ten" == "1234567890" ]
then
echo "${x}" >> correct.txt;
fi;
rm extracted${x}.file;
((x++))
done
I would like to add in an incremental variable to the skip section so once it's completed the 'x' variable to then increment the (skip) 'y' variable by 1 and start the process over.
#!/bin/bash
y=12345
x=40000
until [ $x = "180000" ]; do
dd bs=1 if=static.file of=extracted${x}.file skip=$x count=$x;
first_ten=$(hexdump -e '1/1 "%.2X"' "extracted${x}.file" | head -c 10);
if [ "$first_ten" == "1234567890" ]
then
echo "${y}_${x}" >> correct.txt;
fi;
rm extracted${x}.file;
((x++))
done
Just not totally sure how to achieve this.