echo "^[$*]*[$5][$*]*$" |xargs -I c grep -i c words| grep -i ".....*"| grep -
iv "...........*"| sort -f >list
Can anyone tell me what the c
means after xarg and grep?
important note: words
is a document containing words
echo "^[$*]*[$5][$*]*$" |xargs -I c grep -i c words| grep -i ".....*"| grep -
iv "...........*"| sort -f >list
Can anyone tell me what the c
means after xarg and grep?
important note: words
is a document containing words
From the manual page for xargs
:
-I replace-str
Replace occurrences of replace-str in the initial-arguments with names read from standard input. Also, unquoted blanks do not terminate input items; instead the separator is the newline character. Implies
-x
and-L1
.
So xargs -I c grep -i c words
will replace c
(the argument of -I
) with what's read from standard input, in this case ^[
<positional_args_here>]*[
<5th_positional_arg_here>][
<positional_args_here>]*$
. (The shell will replace $*
and $5
in the quoted string with the positional arguments and the 5th positional argument respectively.)