ired, a favourite hex editor of mine: usage example
github.com
github.com
#!/bin/sh
test $# -gt 0||echo "usage: echo string|${0##\*/} file [blocksize] [seek] [match-no]"
{
read x;
echo pattern: "$x";
echo length: ${#x};
echo;
x=$(echo /\""$x"\"|ired -n $1|sed -n ${4-1}p);
test "$x"||exec echo not found;
printf s"$x"'\n's-${3-0}'\n'x$2'\n'|ired -n $1;
echo;
printf s"$x"'\n's-${3-0}'\n'X$2'\n'|ired -n $1;
echo;
echo w$(printf s"$x"'\n's-${3-0}'\n'X$2'\n'|ired -n $1)|ired -n /dev/stdout;
echo;
}
NB. This script is for use with text/html files, not binary ones.