title: Repeated patterns in the log file
body: <p>Content of the log file is as below,  </p>
  
  <pre><code>I, [2018-03-07T10:21:26.315447 #7531]  INFO -- : POST http://127.0.0.1:8080/api/v3/internal/allowed 6.69490
  I, [2018-03-07T10:21:26.315799 #7531]  INFO -- : gitlab-shell: executing git command &lt;git-upload-pack /var/opt/gitlab/git-data/repositories/GitLab-write-logs/write-logs.git&gt; for user with key key-1.
  I, [2018-03-07T10:23:00.567841 #7739]  INFO -- : POST http://127.0.0.1:8080/api/v3/internal/allowed 5.55714
  I, [2018-03-07T10:23:00.568227 #7739]  INFO -- : gitlab-shell: executing git command &lt;git-upload-pack /var/opt/gitlab/git-data/repositories/GitLab-read-logs/read-logs.git&gt; for user with key key-3.
  I, [2018-03-07T10:23:49.932948 #7851]  INFO -- : gitlab-shell: executing git command &lt;git-receive-pack /var/opt/gitlab/git-data/repositories/GitLab-RW-logs/RW-logs.git&gt; for user with key key-5.
  I, [2018-03-07T10:55:29.533385 #4778]  INFO -- : gitlab-shell: executing git command &lt;git-receive-pack /var/opt/gitlab/git-data/repositories/GitLab-write-logs/write-logs.git&gt; for user with key key-1.
  I, [2018-03-07T10:55:29.810478 #4790]  INFO -- : POST http://127.0.0.1:8080/api/v3/internal/allowed 0.10971
  </code></pre>
  
  <p>Pattern = &lt; git-upload-</p>
  
  <p>There are muliple lines with this matching pattern. How can I extract information from each line. </p>
  
  <p>For a example, in the second line we have matching pattern <strong>&lt; git-upload-</strong> then I would like to extract string <strong>'/var/opt/gitlab/git-data/repositories/GitLab-write-logs/write-logs</strong> from that line and assign to a variable and do some action. </p>
  
  <p>I would like this process to be done to all matched lines sequentially without repeating the same lines, How should I do that? I appreciate everyone's input</p>
  
  <p>Suppose, we have 50 lines with matching patterns lines in them. Can we grep one line one time do action and pick up next line and repeat the same.</p>
  
  <p>logic: </p>
  
  <pre><code>    if more somefile.log | grep -Eq &lt; git-upload-pack ; then
      variable = /var/opt/gitlab/git-data/repositories/GitLab-write-logs/write-logs [ .git shouldn't be there] 
         do some action
      fi 
  </code></pre>
  
  <p>should I put while loop (i=0, i++)to repeat the process on each lines like ..check the line if pattern there then execute "if" condition and exit the condition and repeat for next line I am new to scripting and struggling to connect the dots</p>
  
  <p>Thank you all</p>