title: golang command not working even though manually executing it does
body: <p>I'm trying to execute an <code>awk</code> command in my go program (the awk command pulls zip codes for a specified city, San Francisco in this case, from a tab delimited file of California zip codes):</p>
  
  <pre><code>cmd := exec.Command(
      "awk",
      "-F",
      "'\\t'",
      "'{if ($4 == \"SAN FRANCISCO\") print $0; }'",
      "zipcodes_ca.txt",
  )
  fmt.Println(cmd.Args)
  
  var out bytes.Buffer
  var stderr bytes.Buffer
  cmd.Stdout = &amp;out
  cmd.Stderr = &amp;stderr
  
  err := cmd.Run()
  if err != nil {
      fmt.Println(fmt.Sprint(err) + ": " + stderr.String())
      return
  }
  </code></pre>
  
  <p>This outputs:</p>
  
  <pre><code>[awk -F '\t' '{if ($4 == "SAN FRANCISCO") print $0; }' zipcodes_ca.txt]
  exit status 2: awk: syntax error at source line 1
   context is
           &gt;&gt;&gt; ' &lt;&lt;&lt;
  awk: bailing out at source line 1
  </code></pre>
  
  <p>If I take the printed args from the command and just run that as a command <code>awk -F '\t' '{if ($4 == "SAN FRANCISCO") print $0; }' zipcodes_ca.txt</code> it works.  But, running it through my go program seems to be having issues.  I'm not sure what I'm doing wrong here.  I'm guessing I'm escaping things incorrectly, but nothing I try seems to work.</p>