Create an ascii hexdump from binary or text files, to take a look into format details like line endings, with sfk hexdump for Windows, Mac OS X and Linux.
sfk hexdump [options] dir .ext1 .ext2 .ext3sfk ... +hexfile
create human-readable hexdump of binary data.
options
-showle highlights line end characters CR and LF.
this is default with pure text data.
you may also add "le" to the command name.
-nole do not highlight line end characters.
-wide dumps 32 input bytes per line.
-lean dumps 16 input bytes per line.
-post reduced format e.g. for forum posts
-min minimal format with alnum only text
-nofile or -nofilenames does not list the filename(s).
-rawname prints filename without :file prefix
-pure lists flat hex characters:
53464B2D544553540D0A
-hexsrc lists hex comma separated values:
0x53,0x46,0x4B,0x2D,0x54,0x45,0x53,0x54,0x0D,0x0A,
-decsrc lists decimal comma separated values:
83,70,75,45,84,69,83,84,13,10,
-nolf do not add linefeeds with -pure, -hex/decsrc.
-raw same as -nofile -pure -nolf.
-off[set] n1 dump from offset n1 to file end.
n1 can be negative, for example
-off=-100 dumps last 100 bytes of file.
-last n1 same as -offset -n1
-offlen n1 n2 dump from offset n1 only n2 bytes.
-first n1 same as -offlen 0 n1
-notrail no trailing comma "," at end of hex/dec src
-norectrail no trailing comma at end of every src record
-recsize n only with -hex/decsrc, -pure or -flat:
change no. of input bytes dumped per record.
with default output format, use -wide instead.
-maxdump=n dump only first n bytes of incoming data.
-flat no hexdump, print characters as they come.
command chaining support
since sfk 1.8.4 +hexdump uses text or binary input data
from previous commands, but no filename lists:
sfk xed in.dat +hexdump
dumps chain data produced by xed
sfk select mydir +hexdump
dumps filename characters, but not file contents
to read file contents use +hexfile instead:
sfk select mydir .dat +hexfile
dumps contents of files selected by a command
aliasessfk fhexdump - same as hexfile
sfk hexdumpb - same as "sfk hexdump -nole" for binary
sfk hexdumple - same as "sfk hexdump -showle" for text
sfk postdump - same as "sfk hexdump -post" for forums
see alsosfk hextobin - convert hex dump back to original data.
examplessfk hexdump in.dat
dump contents of in.dat
sfk hexdumple mydir .txt
dump contents of all .txt files in mydir
with highlight of (CR)LF line endings
sfk sel mydir .txt +hexfilele -maxdump=128
similar to above, first selecting files
then dumping only first 128 bytes per file.
sfk hexdump -offlen 4221566976 96 part1.avi
dumps 96 bytes from offset 4221566976 within part1.avi
sfk hexdump -offlen 0xFBA00000 0x60 part1.avi
the same as above, but using hexadecimal numbers
sfk echo foo +atow +hexdump -pure -off 2
convert string to UCS2 wide chars, then
dump this without the 2 bytes BOM header
sfk postdump test.dat +toclip
put test.dat contents into clipboard for posting
sfk hexdump in.dat +view
show hexdump in the depeche view text browser.
works with files up to 4 mb with dview lite.
sfk hexdump -pure -recsize=500 in.dat
create a hexdump with 500 bytes per record.
sfk hexfind in.dat -bin "/a1a2a3a4/"
search byte sequence 0xa1a2a3a4 within in.dat
sfk xhexfind in.dat "/\xa1\xa2\xa3\xa4/"
same as above using xhexfind and simple expressions
example:
check if a script file contains just UNIX LF line endings,
or DOS CR/LF format:
sfk hexdump -showle thescript.bat>6364202E 2E0A726D 202D7266 20746D70<cd ...rm -rf tmp 00000000
>2D73656C 66746573 740A6D6B 64697220<-selftest.mkdir 00000010
>746D702D 73656C66 74657374 0A636420<tmp-selftest.cd 00000020
>746D702D 73656C66 74657374 0A637020<tmp-selftest.cp 00000030
>2D52202E 2E2F7465 73746669 6C657320<-R ../testfiles 00000040
>74657374 66696C65 730A0A65 78706F72<testfiles..expor 00000050
>74205443 4D443D22 636D7020 2E2E2F73<t TCMD="cmp ../s 00000060
>63726970 74732F31 302D7366 6B2D7365<cripts/10-sfk-se 00000070
>6C667465 73742D64 622E7478 74220A0A<lftest-db.txt".. 00000080
>2E202E2E 2F736372 69707473 2F31322D<. ../scripts/12- 00000090
>7375622D 74657374 2D75782E 6261740A<sub-test-ux.bat. 000000a0
>0A636420 2E2E2F73 63726970 74730A<.cd ../scripts. 000000b0
the result shows that the script is in UNIX format (just LF 0x0A,
no CR/LF 0x0D0A).
see also:sfk hextobin - converting hex text to binary.