title: I am trying to use awk to extract a portion of each line in my file
body: <p>I have a large file of user agent strings, and I want to extract one particular section of each request.</p>
  <p>For input:</p>
  <pre><code>207.46.13.9 - - [22/Jan/2019:08:02:29 +0330] &quot;GET /product/23474/%D9%84%DB%8C%D8%B2%D8%B1-%D8%A8%D8%AF%D9%86-%D8%AE%D8%A7%D9%86%DA%AF%DB%8C-%D8%B1%D9%85%DB%8C%D9%86%DA%AF%D8%AA%D9%88%D9%86-%D9%85%D8%AF%D9%84-Remington-Laser-Hair-Removal-IPL6250 HTTP/1.1&quot; 200 41766 &quot;-&quot; &quot;Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)&quot; &quot;-&quot;
  </code></pre>
  <p>I am trying to get output:</p>
  <pre><code>23474
  </code></pre>
  <p>from after <code>/product/</code> in the sample above.</p>
  <p>I'm trying to use Awk, but I can't figure out how to get the regex expression that's required for this. I'm sure it's simpler than I think, but I'm quite new to this!</p>
  <p>The pattern is the following:</p>
  <pre><code>RANDOMSTUFF/GET /product/XXXXX/MORERANDOMSTUFF
  </code></pre>
  <p>and I'm trying to grab <code>XXXXX</code>. I don't think I can use just the '/' since there will be other slashes in the line.</p>
  <p>I've tried</p>
  <pre><code>awk 'BEGIN{FS=&quot;[GET \\/product\\/]&quot;}{print $2}'
  </code></pre>
  <p>to try and use <code>GET /product</code> as a field separator, and then grab the next item. But I've realized this won't work (even if I got the regex expression right, which I didn't), since there might not be whitespace after the product ID I want to grab.</p>