Command Line Interface#
hexrec#
A set of command line utilities for common operations with record files.
Being built with Click, all the
commands follow POSIX-like syntax rules, as well as reserving the virtual
file path -
for command chaining via standard output/input buffering.
hexrec [OPTIONS] COMMAND [ARGS]...
clear#
Clears an address range.
INFILE
is the path of the input file.
Set to -
to read from standard input; input format required.
OUTFILE
is the path of the output file.
Set to -
to write to standard output.
hexrec clear [OPTIONS] INFILE OUTFILE
Options
- -i, --input-format <input_format>#
Forces the input file format. Required for the standard input.
- Options:
ascii_hex | binary | intel | mos | motorola | tektronix
- -o, --output-format <output_format>#
Forces the output file format. By default it is that of the input file.
- Options:
ascii_hex | binary | intel | mos | motorola | tektronix
- -s, --start <start>#
Inclusive start address. Negative values are referred to the end of the data. By default it applies from the start of the data contents.
- -e, --endex <endex>#
Exclusive end address. Negative values are referred to the end of the data. By default it applies till the end of the data contents.
Arguments
- INFILE#
Required argument
- OUTFILE#
Required argument
convert#
Converts a file to another format.
INFILE
is the list of paths of the input files.
Set to -
to read from standard input; input format required.
OUTFILE
is the path of the output file.
Set to -
to write to standard output.
hexrec convert [OPTIONS] INFILE OUTFILE
Options
- -i, --input-format <input_format>#
Forces the input file format. Required for the standard input.
- Options:
ascii_hex | binary | intel | mos | motorola | tektronix
- -o, --output-format <output_format>#
Forces the output file format. By default it is that of the input file.
- Options:
ascii_hex | binary | intel | mos | motorola | tektronix
Arguments
- INFILE#
Required argument
- OUTFILE#
Required argument
crop#
Selects data from an address range.
INFILE
is the path of the input file.
Set to -
to read from standard input; input format required.
OUTFILE
is the path of the output file.
Set to -
to write to standard output.
hexrec crop [OPTIONS] INFILE OUTFILE
Options
- -i, --input-format <input_format>#
Forces the input file format. Required for the standard input.
- Options:
ascii_hex | binary | intel | mos | motorola | tektronix
- -o, --output-format <output_format>#
Forces the output file format. By default it is that of the input file.
- Options:
ascii_hex | binary | intel | mos | motorola | tektronix
- -v, --value <value>#
Byte value used to flood the address range. By default, no flood is performed.
- -s, --start <start>#
Inclusive start address. Negative values are referred to the end of the data. By default it applies from the start of the data contents.
- -e, --endex <endex>#
Exclusive end address. Negative values are referred to the end of the data. By default it applies till the end of the data contents.
Arguments
- INFILE#
Required argument
- OUTFILE#
Required argument
cut#
Selects data from an address range.
DEPRECATED: Use the crop command instead.
INFILE
is the path of the input file.
Set to -
to read from standard input; input format required.
OUTFILE
is the path of the output file.
Set to -
to write to standard output.
hexrec cut [OPTIONS] INFILE OUTFILE
Options
- -i, --input-format <input_format>#
Forces the input file format. Required for the standard input.
- Options:
ascii_hex | binary | intel | mos | motorola | tektronix
- -o, --output-format <output_format>#
Forces the output file format. By default it is that of the input file.
- Options:
ascii_hex | binary | intel | mos | motorola | tektronix
- -v, --value <value>#
Byte value used to flood the address range. By default, no flood is performed.
- -s, --start <start>#
Inclusive start address. Negative values are referred to the end of the data. By default it applies from the start of the data contents.
- -e, --endex <endex>#
Exclusive end address. Negative values are referred to the end of the data. By default it applies till the end of the data contents.
Arguments
- INFILE#
Required argument
- OUTFILE#
Required argument
delete#
Deletes an address range.
INFILE
is the path of the input file.
Set to -
to read from standard input; input format required.
OUTFILE
is the path of the output file.
Set to -
to write to standard output.
hexrec delete [OPTIONS] INFILE OUTFILE
Options
- -i, --input-format <input_format>#
Forces the input file format. Required for the standard input.
- Options:
ascii_hex | binary | intel | mos | motorola | tektronix
- -o, --output-format <output_format>#
Forces the output file format. By default it is that of the input file.
- Options:
ascii_hex | binary | intel | mos | motorola | tektronix
- -s, --start <start>#
Inclusive start address. Negative values are referred to the end of the data. By default it applies from the start of the data contents.
- -e, --endex <endex>#
Exclusive end address. Negative values are referred to the end of the data. By default it applies till the end of the data contents.
Arguments
- INFILE#
Required argument
- OUTFILE#
Required argument
fill#
Fills an address range with a byte value.
INFILE
is the path of the input file.
Set to -
to read from standard input; input format required.
OUTFILE
is the path of the output file.
Set to -
to write to standard output.
hexrec fill [OPTIONS] INFILE OUTFILE
Options
- -i, --input-format <input_format>#
Forces the input file format. Required for the standard input.
- Options:
ascii_hex | binary | intel | mos | motorola | tektronix
- -o, --output-format <output_format>#
Forces the output file format. By default it is that of the input file.
- Options:
ascii_hex | binary | intel | mos | motorola | tektronix
- -v, --value <value>#
Byte value used to fill the address range.
- -s, --start <start>#
Inclusive start address. Negative values are referred to the end of the data. By default it applies from the start of the data contents.
- -e, --endex <endex>#
Exclusive end address. Negative values are referred to the end of the data. By default it applies till the end of the data contents.
Arguments
- INFILE#
Required argument
- OUTFILE#
Required argument
flood#
Fills emptiness of an address range with a byte value.
INFILE
is the path of the input file.
Set to -
to read from standard input; input format required.
OUTFILE
is the path of the output file.
Set to -
to write to standard output.
hexrec flood [OPTIONS] INFILE OUTFILE
Options
- -i, --input-format <input_format>#
Forces the input file format. Required for the standard input.
- Options:
ascii_hex | binary | intel | mos | motorola | tektronix
- -o, --output-format <output_format>#
Forces the output file format. By default it is that of the input file.
- Options:
ascii_hex | binary | intel | mos | motorola | tektronix
- -v, --value <value>#
Byte value used to flood the address range.
- -s, --start <start>#
Inclusive start address. Negative values are referred to the end of the data. By default it applies from the start of the data contents.
- -e, --endex <endex>#
Exclusive end address. Negative values are referred to the end of the data. By default it applies till the end of the data contents.
Arguments
- INFILE#
Required argument
- OUTFILE#
Required argument
merge#
Merges multiple files.
INFILES
is the list of paths of the input files.
Set any to -
to read from standard input; input format required.
OUTFILE
is the path of the output file.
Set to -
to write to standard output.
Every file of INFILES
will overwrite data of previous files of the
list where addresses overlap.
hexrec merge [OPTIONS] INFILES... OUTFILE
Options
- -i, --input-format <input_format>#
Forces the input file format. Required for the standard input.
- Options:
ascii_hex | binary | intel | mos | motorola | tektronix
- -o, --output-format <output_format>#
Forces the output file format. By default it is that of the input file.
- Options:
ascii_hex | binary | intel | mos | motorola | tektronix
Arguments
- INFILES#
Required argument(s)
- OUTFILE#
Required argument
motorola#
Motorola SREC specific
hexrec motorola [OPTIONS] COMMAND [ARGS]...
del-header#
Deletes the header data record.
INFILE
is the path of the input file; ‘motorola’ record type.
Set to -
to read from standard input.
OUTFILE
is the path of the output file.
Set to -
to write to standard output.
hexrec motorola del-header [OPTIONS] INFILE OUTFILE
Arguments
- INFILE#
Required argument
- OUTFILE#
Required argument
get-header#
Gets the header data.
INFILE
is the path of the input file; ‘motorola’ record type.
Set to -
to read from standard input.
hexrec motorola get-header [OPTIONS] INFILE
Options
- -f, --format <format>#
Header data format.
Arguments
- INFILE#
Required argument
set-header#
Sets the header data record.
INFILE
is the path of the input file; ‘motorola’ record type.
Set to -
to read from standard input.
OUTFILE
is the path of the output file.
Set to -
to write to standard output.
hexrec motorola set-header [OPTIONS] HEADER INFILE OUTFILE
Options
- -f, --format <format>#
Header data format.
Arguments
- HEADER#
Required argument
- INFILE#
Required argument
- OUTFILE#
Required argument
reverse#
Reverses data.
INFILE
is the path of the input file.
Set to -
to read from standard input; input format required.
OUTFILE
is the path of the output file.
Set to -
to write to standard output.
hexrec reverse [OPTIONS] INFILE OUTFILE
Options
- -i, --input-format <input_format>#
Forces the input file format. Required for the standard input.
- Options:
ascii_hex | binary | intel | mos | motorola | tektronix
- -o, --output-format <output_format>#
Forces the output file format. By default it is that of the input file.
- Options:
ascii_hex | binary | intel | mos | motorola | tektronix
Arguments
- INFILE#
Required argument
- OUTFILE#
Required argument
shift#
Shifts data addresses.
INFILE
is the path of the input file.
Set to -
to read from standard input; input format required.
OUTFILE
is the path of the output file.
Set to -
to write to standard output.
hexrec shift [OPTIONS] INFILE OUTFILE
Options
- -i, --input-format <input_format>#
Forces the input file format. Required for the standard input.
- Options:
ascii_hex | binary | intel | mos | motorola | tektronix
- -o, --output-format <output_format>#
Forces the output file format. By default it is that of the input file.
- Options:
ascii_hex | binary | intel | mos | motorola | tektronix
- -n, --amount <amount>#
Address shift to apply.
Arguments
- INFILE#
Required argument
- OUTFILE#
Required argument
validate#
Validates a record file.
INFILE
is the path of the input file.
Set to -
to read from standard input; input format required.
hexrec validate [OPTIONS] INFILE
Options
- -i, --input-format <input_format>#
Forces the input file format. Required for the standard input.
- Options:
ascii_hex | binary | intel | mos | motorola | tektronix
Arguments
- INFILE#
Required argument
xxd#
Emulates the xxd command.
Please refer to the xxd manual page to know its features and caveats.
Some parameters were changed to satisfy the POSIX-like command line parser.
hexrec xxd [OPTIONS] INFILE OUTFILE
Options
- -a, --autoskip#
Toggles autoskip.
A single ‘*’ replaces null lines.
- -b, --bits#
Binary digits.
Switches to bits (binary digits) dump, rather than hexdump. This option writes octets as eight digits of ‘1’ and ‘0’ instead of a normal hexadecimal dump. Each line is preceded by a line number in hexadecimal and followed by an ASCII (or EBCDIC) representation. The argument switches -r, -p, -i do not work with this mode.
- -c, --cols <cols>#
Formats <cols> octets per line. Max 256.
Defaults: normal 16, -i 12, -p 30, -b 6.
- -E, --ebcdic, --EBCDIC#
Uses EBCDIC charset.
Changes the character encoding in the right-hand column from ASCII to EBCDIC. This does not change the hexadecimal representation. The option is meaningless in combinations with -r, -p or -i.
- -e, --endian#
Switches to little-endian hexdump.
This option treats byte groups as words in little-endian byte order. The default grouping of 4 bytes may be changed using -g. This option only applies to hexdump, leaving the ASCII (or EBCDIC) representation unchanged. The switches -r, -p, -i do not work with this mode.
- -g, --groupsize <groupsize>#
Byte group size.
Separates the output of every <groupsize> bytes (two hex characters or eight bit-digits each) by a whitespace. Specify <groupsize> 0 to suppress grouping. <groupsize> defaults to 2 in normal mode, 4 in little-endian mode and 1 in bits mode. Grouping does not apply to -p or -i.
- -i, --include#
Output in C include file style.
A complete static array definition is written (named after the input file), unless reading from standard input.
- -l, --length, --len <length>#
Stops after writing <length> octets.
- -o, --offset <offset>#
Adds <offset> to the displayed file position.
- -p, --postscript, --plain, --ps#
Outputs in postscript continuous hexdump style.
Also known as plain hexdump style.
- -q, --quadword#
Uses 64-bit addressing.
- -r, --revert#
Reverse operation.
Convert (or patch) hexdump into binary. If not writing to standard output, it writes into its output file without truncating it. Use the combination -r and -p to read plain hexadecimal dumps without line number information and without a particular column layout. Additional Whitespace and line breaks are allowed anywhere.
- -k, --seek <oseek>#
Output seeking.
When used after -r reverts with -o added to file positions found in hexdump.
- -s <iseek>#
Input seeking.
Starts at <s> bytes absolute (or relative) input offset. Without -s option, it starts at the current file position. The prefix is used to compute the offset. ‘+’ indicates that the seek is relative to the current input position. ‘-’ indicates that the seek should be that many characters from the end of the input. ‘+-’ indicates that the seek should be that many characters before the current stdin file position.
- -U, --upper-all#
Uses upper case hex letters on address and data.
- -u, --upper#
Uses upper case hex letters on data only.
- -v, --version#
Prints the package version number.
Arguments
- INFILE#
Required argument
- OUTFILE#
Required argument