Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
ired, a favourite hex editor of mine: usage example (github.com/radare)
2 points by 1vuio0pswjnm7 on Dec 8, 2023 | hide | past | favorite | 1 comment


   #!/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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: