Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I haven't used a hex-editor in decades. This is one of the few times where I still use Perl instead of Python.

    $ perl -i.bak -p0777e \
        'print STDERR s/\xe4\x0a\x00\x2d/\xde\xad\xbe\xef/g + 0 . "\n"' a.out
    1
    $ cmp -l a.out.bak a.out
      50161 344 336
      50162  12 255
      50163   0 276
      50164  55 357
    $
Perl prints the number of substitutions done. If it's 1, all's well.


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

Search: