How to use xargs within xargs ?
I have a command which produces multi line output with each line consisting of two fields seperated by a '=' where the first field is a module name and the second field is the value. I have to set the value of each to something else. the command to set value syntax is like
Code:
<module name>=<value> what i'm trying here is like this. Code:
<command to produce multi line output> | xargs -i sh -c 'echo $0 | cut -d= -f1 | xargs -i <command to set the value> {}=<value>' '{} I know it becomes easier if I redirect the output from cut to a file and then start a new xargs chain, but i am curious if there is a simpler way to do this in a single command chain. |
I've a suspicion nested xargs might not be the best plan but from a syntax point of view "xargs -i" takes optional text to specify what the recall symbol is.
Code:
something | xargs -i{} command thingy {} | xargs -iAA othercommand AA |
All times are GMT -5. The time now is 04:38 PM. |