Avoid external dependencies

Little fix to avoid external (non-coreutils) dependencies like vim (for xxd) and sed.
+ Little optimisation
+ Little fix (originally sed calls missed "/g")
Merge pull request #7 from msva/patch-2

Avoid external dependencies