title: using xargs multiple times in one command in linux command line
body: <p>I am trying to write a one liner and cannot figure out what I am doing wrong.  I am trying to use the following command:</p>
  
  <pre><code>cat testadds | cut -f 1 -d "," | xargs -ifoo /bin/bash -c "cat testadds | cut -f 2 -d \",\" | xargs --replace=addr /bin/bash -c \"cat testadds | cut -f 3 -d \",\" | xargs --replace=num /bin/bash -c \"cat testmdl | sed 's/DUMMY/foo/g' | sed 's/IP1/addr/g' | sed 's/IP2/num/g'\"\""
  </code></pre>
  
  <p>I get nothing for an out put, my <code>testadds</code> file is set up as follows:</p>
  
  <pre><code>dev,IP1,IP2
  </code></pre>
  
  <p>when I do this with only 2 <code>xargs</code>, it works fine, but when I add the 3rd and last <code>xargs</code>, it provides no output.  I am wondering if there is a limit to how many times you can use <code>xargs</code> when cating a file.</p>
  
  <p>I guess the expected input is from a file that has multiple devices. the input would be testdevice,1.1.1.1,2.2.2.2   </p>
  
  <p>The exepected output would be:<br>
  -deviceSystemSoftware 'device:testdevice' '6500 7-SLOT OPTICAL SW:1021'<br>
  -deviceCname 'device:testdevice' 'PRIORITY SLA - identifier - testdevice'<br>
  -deviceDateAdded 'device:testdevice' '2017-02-24'<br>
  -deviceNotes 'device:testdevice' 'BTWB100269 - testdevice'<br>
  -hier 'nib:opr|0 group:Openreach group:TSO'<br>
  -hier 'nib:opr|0 group:Openreach group:TSO group:Ciena'<br>
  -hierUnique 'nib:opr|0 group:Openreach group:TSO group:Ciena device:testdevice'  </p>
  
  <p>-createEntity 'service:snmp-trap-handling{device:testdevice}CA|0[+opr-ciena-6500-alarms|+Nocol]'<br>
  -createEntity 'service:configuration-tracking{device:testdevice}opr|0[ciena6500]'  </p>
  
  <p>-createEntity 'interface:testdevice|COLAN-1-X'<br>
  -entityDescription 'interface:testdevice|COLAN-1-X' 'COLAN-1-X'<br>
  -createEntity 'address:testdevice|COLAN-1-X|1.1.1.1'<br>
  -devicePrimaryInterface 'device:testdevice' 'interface:testdevice|COLAN-1-X'<br>
  -deleteEntity 'address:testdevice|mgmt|1.1.1.1'<br>
  -deleteEntity 'service:ippingmon{interface:testdevice|mgmt}opr|0[]'<br>
  -deleteEntity 'interface:testdevice|mgmt'<br>
  -createEntity 'interface:testdevice|SHELFIP'<br>
  -entityDescription 'interface:testdevice|SHELFIP' 'SHELFIP'<br>
  -createEntity 'address:testdevice|SHELFIP|2.2.2.2'  </p>
  
  <p>Hopefully this helps</p>
  
  <p>What I am trying to accomplish is to modify the files to display them as the expected output.  This is to add it to my monitoring system.  Sorry, this is the first time I have ever done this, so I apologize for any lack of information.</p>