xxd --help
Usage:
xxd [options] [infile [outfile]]
or
xxd -r [-s [-]offset] [-c cols] [-ps] [infile [outfile]]
Options:
-a toggle autoskip: A single '*' replaces nul-lines. Default off.
-b binary digit dump (incompatible with -ps,-i,-r). Default hex.
-C capitalize variable names in C include file style (-i).
-c cols format <cols> octets per line. Default 16 (-i: 12, -ps: 30).
-E show characters in EBCDIC. Default ASCII.
-e little-endian dump (incompatible with -ps,-i,-r).
-g bytes number of octets per group in normal output. Default 2 (-e: 4).
-h print this summary.
-i output in C include file style.
-l len stop after <len> octets.
-n name set the variable name used in C include output (-i).
-o off add <off> to the displayed file position.
-ps output in postscript plain hexdump style.
-r reverse operation: convert (or patch) hexdump into binary.
-r -s off revert with <off> added to file positions found in hexdump.
-d show offset in decimal instead of hex.
-s [+][-]seek start at <seek> bytes abs. (or +: rel.) infile offset.
-u use upper case hex letters.
-v show version: "xxd 2022-01-14 by Juergen Weigert et al.".
cat test.txt
Hello World
xxd test.txt
00000000: 4865 6c6c 6f20 576f 726c 640a Hello World.
skip 前n字节
xxd -s 1 test.txt
00000001: 656c 6c6f 2057 6f72 6c64 0a ello World.
xxd -s 2 test.txt
00000002: 6c6c 6f20 576f 726c 640a llo World.
只读取最后n字节
xxd -s -5 test.txt
00000007: 6f72 6c64 0a orld.
xxd -s -4 test.txt
00000008: 726c 640a rld.
xxd -l 6 -ps -c 3 test.txt
48656c
6c6f20
xxd -l 6 -c 3 test.txt
00000000: 4865 6c Hel
00000003: 6c6f 20 lo
https://github.com/ckormanyos/xxd
标签:ps,Default,xxd,test,World,txt From: https://www.cnblogs.com/Searchor/p/17287111.html