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")