title: telegraf and script command to send to grafana
body: <p>I have the following inputs in my telegraf.conf that go to Grafana. I can get the simpler first 3 examples to work but cannot get the 4th to work.</p>
  <pre><code>[[inputs.exec]]
  commands = [&quot;sh -c 'grep -i DatasetVersion /etc/aaa/systemnameX/configfile | cut -d'=' -f2'&quot;]
  name_override = &quot;systemnameX&quot;
  timeout = &quot;5s&quot;
  data_format = &quot;value&quot;
  data_type = &quot;string&quot;
  [inputs.exec.tags]
  type = &quot;dataset_version&quot;
  
  [[inputs.exec]]
  commands = [&quot;sh -c 'cat /root/config/OS_Version.txt | tr -d C'&quot;]
  name_override = &quot;systemnameX&quot;
  timeout = &quot;5s&quot;
  data_format = &quot;value&quot;
  data_type = &quot;string&quot;
  [inputs.exec.tags]
  type = &quot;os_version&quot;
  
  [[inputs.exec]]
  commands = [&quot;sh -c 'grep -i VERSION= /usr/bin/sw_install | head -1 | cut -d'=' -f2 '&quot;]
  name_override = &quot;systemnameX&quot;
  timeout = &quot;5s&quot;
  data_format = &quot;value&quot;
  data_type = &quot;string&quot;
  [inputs.exec.tags]
  type = &quot;sw_version&quot;
  
  [[inputs.exec]]
  commands = [&quot;/sbin/ifconfig eth0 | grep 'inet' | cut -d: -f2 | awk '{print $2}'&quot;]
  name_override = &quot;systemnameX&quot;
  timeout = &quot;5s&quot;
  data_format = &quot;value&quot;
  data_type = &quot;string&quot;
  [inputs.exec.tags]
  type = &quot;ip_address&quot;
  </code></pre>
  <p>This is the error when I run the telegraf test</p>
  <pre><code>2021-09-04T06:36:51Z E! Error in plugin [inputs.exec]: exec: exit status 1 for command '/sbin/ifconfig eth0 | grep 'inet' | cut -d: -f2 | awk '{print $2}''
  </code></pre>
  <p>and when I put the exact command into a command line I get the following error:</p>
  <pre><code>awk: cmd. line:1: {print
  awk: cmd. line:1:       ^ unexpected newline or end of string
  </code></pre>
  <p>Any help about how to fix the awk part would be greatly appreciated.</p>
  <p>cheers,
  Tara</p>