title: Extract specific information in a log file using shell script
body: <p>shell.log and log format is like 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-write-logs/write-logs.git&gt; for user with key key-1.
  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-write-logs/write-logs.git&gt; for user with key key-1.
  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>If you see the above log file details, you can see this quoted pattern in some of lines</p>
  
  <p>" &lt; git-upload-pack /var/opt/gitlab/git-data/repositories/GitLab-write-logs/write-logs.git> for user with key key-1." </p>
  
  <p>This means <strong>git-upload-pack</strong> is an activity which is happening on directory " <strong>/var/opt/gitlab/git-data/repositories/GitLab-write-logs/write-logs.git</strong>" by user with ssh key <strong>"key-1"</strong></p>
  
  <p>Now I want to track this specific "git-upload-pack" activity on different directories whenever it is recorded in shell.log file</p>
  
  <p>I am looking to write a script and with help of cron job to keep reading the new lines with this specific activity. I would the script to do below activity. </p>
  
  <p>I am considering here, second line from top in log file with number #7531</p>
  
  <p>Here now I see "git-upload-pack" string in the second line, so script should extract the directory information from the line which is "/var/opt/gitlab/git-data/repositories/GitLab-write-logs/write-logs" and create a directory name at different path location and there create a log file inside the newly created directory and echo "$key-1 $Time stamp" >> to that log file. </p>
  
  <p>Shell.log file keep updates as the activities happens everytime, Script should capture the details once it shouldn't capture same activity. How can I achieve this output?</p>
  
  <p>Thank you All</p>