Skip to main content
edited body
Source Link

I tend to use this:

command1 | xargs -I{} command2 {}

Pass output of command1 through xargs using substitution (the braces) to command2. If command1 is find be sure to use -print0 and add -0 to xargs for null terminated strings and xargs will call command2 for each thing found.

In your case (and taking the sed line from @Janos@janos):

command1 -p=aaa -v=bbb -i=4 | sed -ne 's/^rate..\([0-9]*\)%.*/\1/p' | xargs -I{} command2 -t="rate was {}"

I tend to use this:

command1 | xargs -I{} command2 {}

Pass output of command1 through xargs using substitution (the braces) to command2. If command1 is find be sure to use -print0 and add -0 to xargs for null terminated strings and xargs will call command2 for each thing found.

In your case (and taking the sed line from @Janos):

command1 -p=aaa -v=bbb -i=4 | sed -ne 's/^rate..\([0-9]*\)%.*/\1/p' | xargs -I{} command2 -t="rate was {}"

I tend to use this:

command1 | xargs -I{} command2 {}

Pass output of command1 through xargs using substitution (the braces) to command2. If command1 is find be sure to use -print0 and add -0 to xargs for null terminated strings and xargs will call command2 for each thing found.

In your case (and taking the sed line from @janos):

command1 -p=aaa -v=bbb -i=4 | sed -ne 's/^rate..\([0-9]*\)%.*/\1/p' | xargs -I{} command2 -t="rate was {}"
added 171 characters in body
Source Link

I tend to use this:

command1 | xargs -I{} command2 {}

Pass output of command1 through xargs using substitution (the braces) to command2. If command1 is find be sure to use -print0 and add -0 to xargs for null terminated strings and xargs will call command2 for each thing found.

In your case (and taking the sed line from @Janos):

command1 -p=aaa -v=bbb -i=4 | sed -ne 's/^rate..\([0-9]*\)%.*/\1/p' | xargs -I{} command2 -t="rate was {}"

I tend to use this:

command1 | xargs -I{} command2 {}

Pass output of command1 through xargs using substitution (the braces) to command2. If command1 is find be sure to use -print0 and add -0 to xargs for null terminated strings and xargs will call command2 for each thing found.

I tend to use this:

command1 | xargs -I{} command2 {}

Pass output of command1 through xargs using substitution (the braces) to command2. If command1 is find be sure to use -print0 and add -0 to xargs for null terminated strings and xargs will call command2 for each thing found.

In your case (and taking the sed line from @Janos):

command1 -p=aaa -v=bbb -i=4 | sed -ne 's/^rate..\([0-9]*\)%.*/\1/p' | xargs -I{} command2 -t="rate was {}"
Source Link

I tend to use this:

command1 | xargs -I{} command2 {}

Pass output of command1 through xargs using substitution (the braces) to command2. If command1 is find be sure to use -print0 and add -0 to xargs for null terminated strings and xargs will call command2 for each thing found.