nl=hex_split()( split="${nl:= }" rad=0 c=0unset c dump slice rad pend dump=something${nl}is${nl}being$ _get(){nl dd bs=1024 count=1; echo .; }written$ 2>/dev/null _buf() case $((${nl#dump}here$>0)):$((${nl#slice}>0)) in until [ -z "$dump" ] do break= (0:;*) set -- dump=$(_get); dump=${dump%.} while [ -n "$dump" ] do c=${dump%"${dump#?}"} [ -n "$dump" ] || [ -n "$slice" dump=${dump#?}];; case $#$c in (30*|*$split*:0) ! : ;; [ "${#dump}" -lt 16 ] && esac || break=break set "$@" "'$c" "$ slice=${c#[![:printdump:]]-$slice}." dump= && return "$break" done slice=${dump%"${dump#$q}"} dump=${dump#$q};;esac _out(){ printf "%08x%02.0s" "$rad" "$((rad+=$#/2))" printf "%02x %.0s" "$@" printf "%-$(((16-($#/2))*3))s" printf "%.0s%.1s" '' ' ' '' \| "$@" '' \| '' "$nl" }; q=$(printf %016s|tr \ \?) ; IFS=\ nl=' ' rad=0 c=0 split=${split:-$nl} slice="$*"; set -- while [ -n "$slice" ] || _buf || ! ${1:+"_out"} "$@" && c=${slice%"${slice#?}"} slice=${slice#?} do set "$@" "'$c" "${c#[![:print:]]}." case $#$c in (32*|*$split) _out "$@"; set --;;esac done ) You can hand it stdin or arguments or both. So...
echo "something is being written here" | hex_split something else besides 00000000 73 6f 6d 65 74 68 69 6e 67 20 65 6c 73 65 20 62 |something else b| 00000010 65 73 69 64 65 73 00 73 6f 6d 65 74 68 69 6e 67 |esides.something| 00000020 0a |something |.| 0000000a00000021 69 73 0a |is.| 0000000d00000024 62 65 69 6e 67 0a |being.| 000000130000002a 77 72 69 74 74 65 6e 0a |written.| 0000001b00000032 68 65 72 65 0a |here.| Change the default split char like...
split=${somechar} hex_split