It's simple enough to parse the output into the format you want:
xxd -b /root/Desktop/image.png | cut -d: -f 2 | sed 's/ .*//; s/ //g'
The cut
will remove the line numbers and the sed will first remove the last column (s/ .*//
will remove everything that comes after two consecutive spaces) and then removes all single spaces.
You could also use awk
:
xxd -b ~/a.png | awk ''
Or Perl:
xxd -b ~/a.png | head -1 | perl -lane 'print join "",@F[1..6]'
Or coreutils:
xxd -b ~/a.png | cut -d" " -f2-7 | tr -d ' '