Read hex data into less

2020-02-13 06:39发布

问题:

I want to give a big data file to less -s -M +Gg such that read current given data in less -s -M +Gg.

While-loop example (see ntc2's answer)

Less command explained here. Replacing the yes by a binary file which is converted to binary ascii and hex:

while read -u 10 p || [[ -n $p ]]; do
    hexdump -e '/4 "%08x\n"' {$p}                       \
                                                        \
    | less -s -M +Gg
done 10</Users/masi/Dropbox/7-8\:2015/r3.raw

where the looping is based on this thread here.

How can you read such data into less?

回答1:

I don't understand the details of the example, but I think you want to put the less outside of the loop, like this:

while read -u 10 p || [[ -n $p ]]; do
    hexdump -e '/4 "%08x\n"' {$p}
done 10</Users/masi/Dropbox/7-8\:2015/r3.raw | less -s -M +Gg


标签: hex less hexdump