Flag | Usage |
---|---|
-d --decompress --uncompress |
|
Flag | Usage |
---|---|
-p -plain | output result in PostScript continuous hex dump style aka plain |
-r -revert | convert hex dump into binary |
H
character, which has the 48
hexadecimal value in the ASCII tableecho -n 'H' | xxd -p 48 echo -n '\x48' | xxd -r -p HSame thing with
[BACKSPACE]
aka \x08
:
echo -n 'ABC'; echo -n '\x08' | xxd -r -p
AB
xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 optionWhen I got this error, some of the returned files actually had single quotes
'
in their path / name / both (not checked whether the number of quotes was even or not in the path / name / both : xargs seemed unhappy anyway).
while read
with process substitution construct :
while read fileName; do # do something done < <(find )
a b c
a b c
Flag | Usage |
---|---|
-0 --null |
|
-I pattern |
-i and --replace are deprecated
|
-L n --max-lines=n |
|
-n n | Pop n arguments at a time from the list to feed utility |
-P n | Execute at most n parallel instances of utility. Defaults to 1. (source).
-n should be specified when using -P or there is a risk of firing only 1 instance of utility.
|
-s maxChars --max-chars=maxChars |
|
-x | exit if the size specified with -s is exceeded |
a b c d e f g h i j k l m n o p q r s t u v w x y z
a b c d e
a b c d e
Killing so many processes this way is VERY! BAD!. Do this only if :
sh -c 'someCommand'
above means run someCommand within the /bin/sh shell. Some advanced commands / flags / options may not be available in this shell. Consider
bash -c 'someCommand'
then.#!/usr/bin/env bash myStackedList=$(echo {a..z} | tr ' ' '\n') just generating a stacked list echo "$myStackedList" | xargs -L 12 echo and displaying it as slices of 12 grouped letters echo doSomething() { a dummy function that "does things", needed for the demo echo "$@," } export -f doSomething this makes the exported function exist as a command available to xargs (source) echo "$myStackedList" | xargs -L 12 bash -c 'doSomething "$@"' _read details below
a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l, m n o p q r s t u v w x, y z,
bash -c 'doSomething "$@"' _
part :bash -c 'command'
: run command within BashdoSomething "$@"
: this passes along all arguments provided to command to the doSomething
function_
:
$0
(i.e. shell name), to be used in warning and error messagesless -p "-c option"
' bash (mankier.com, gnu.org)