title: Using sed command in C file
body: <p><a href="https://i.stack.imgur.com/nbTSy.png" rel="nofollow noreferrer">Click to see image</a> I am trying to use the <code>sed</code> command to extract a string in parentheses from many strings that a terminal returns. For example, I want to extract the string &quot;Glass&quot; that is in parentheses:</p>
  <p>In Terminal I execute a  program that prints out:</p>
  <pre><code>People: Leela, Amy, Bender, Zack
  Item: Ship, Food, Gum, Water
  Delivery: Pizza, Newspaper, Plant
  Broken: Gas Tank, Watch, (Glasses)  
  </code></pre>
  <p>For testing, purposes I wrote this in the terminal:</p>
  <pre><code>echo &quot;Broken: Gas tank, Watch, (Glasses)&quot; | sed 's/.*(\(.*\)).*/\1/'  
  </code></pre>
  <p>The terminal returned:</p>
  <pre><code>Glass
  </code></pre>
  <p>which is the correct answer. But When I try to declare it in the .c file, my IDE seems it cannot interpreter the <code>sed</code> command. It seems like I need to format the <code>sed</code> command. The way I am using the <code>sed</code> command is:</p>
  <pre><code>static const * getBrokenItem(void){
  #define CMD &quot; grep \&quot;Broken: \&quot; |sed 's/.*(\(.*\)).*/\1/'&quot;
       FILE *fp = NULL;
       fp = open(CMD, &quot;r&quot;);
       bla..bla...
       bla..bla...
  }
  </code></pre>
  <p>The IDE (Visual Studio) does not like the &quot;(&quot; and &quot;)&quot; in</p>
  <pre><code>sed 's/.*(\(.*\)).*/\1/'&quot;
  </code></pre>
  <p>I attached a snip here so it is easier to identify which &quot;\(&quot; and &quot;\)&quot; I'm referring to.</p>
  <p>I have tried to add an additional &quot;&quot; next to the original &quot;&quot; since in C programming you need to do print(&quot;Backslash \&quot;) to print one backslash, but it did not work.</p>
  <p>Can someone let me know what might be wrong please?</p>