echo "^[$*]*[$5][$*]*$" |xargs -I c grep -i c words| grep -i ".....*"| grep -
iv "...........*"| sort -f >list
有人能告诉我{x}和grep之后c
的含义吗?
重要提示:words
是一个包含文字
答案 0 :(得分:0)
来自xargs
的{{3}}:
-I replace-str
将initial-arguments中出现的replace-str替换为从标准输入读取的名称。此外,不带引号的空格不会终止输入项;相反,分隔符是换行符。隐含
-x
和-L1
。
所以xargs -I c grep -i c words
会将c
(-I
的参数)替换为从标准输入中读取的内容,在这种情况下^[
< positional_args_here> { {1}}< 5th_positional_arg_here> ]*[
< positional_args_here> ][
。 (shell将分别用位置参数和第五个位置参数替换引用字符串中的]*$
和$*
。)