I need to pass two arguments to the same command. The output of the first command look like this:
BLA BLE
A1 B2
A2 B3
Right now I using this for using the first argument
firstCommand | tail -n1 | awk '{print $1}' | xargs -I_ secondCommand _
But the secondCommand has changed and right now I need to pass a second argument
secondComman A --second B
Is this posssible using xargs?
I try multiple stackoverflow solution, but none with was succesful.
>Solution :
Add printing 2nd argument to awk and capture 2 arguments with xargs:
firstCommand | tail -n1 | awk '{print $1,$2}' | xargs -n2 sh -c 'secondCommand "$1" --second "$2"' _