title: bash: find all regex in file and put into array
body: <p>I have a template config file with <strong>PlaceHolders</strong>, and i want to find all those PlaceHolders and put inside an array.</p>
  
  <p><strong>The curent state:</strong><br>
  I can find all the PlaceHolders in file only if there is <strong>no</strong> more than <strong>one</strong> PlaceHolder in a <strong>line</strong>.</p>
  
  <p><strong>For example</strong>, this is my template file:</p>
  
  <pre><code>upstream portal {        
     server {{UNICORN_SERVICE_NAME}}:{{UNICORN_SERVICE_PORT}};  
  }
  
  server {
    listen *:80 default_server;         
    server_name {{APP_HOST}};     
    server_tokens off;     
    root /dev/null;
  
    # Increase this if you want to upload large attachments
    # Or if you want to accept large git objects over http
    client_max_body_size {{NGINX_MAX_UPLOAD_SIZE}};
  
    location {{GITLAB_RELATIVE_URL_ROOT}}/ {
      root /var/lib/nginx/portal;
      # serve static files from defined root folder;.
      # @gitlab is a named location for the upstream fallback, see below    
    }
    }
  </code></pre>
  
  <p><strong>this is the code</strong> i use to find the PlaceHolders:</p>
  
  <pre><code>matches_bloc=$(awk 'match($0, /(\{\{)([^{]*)(\}\})/) {
                      print substr($0, RSTART, RLENGTH)                    
                  }' ${currFile})
  
              # convert 'matches_bloc' into array
              matches=()
              echo "Matches:"
              while read -r line; do
                  matches+=("$line")
                  echo "  - ${line}"
              done &lt;&lt;&lt; "$matches_bloc"
  </code></pre>
  
  <p>in this example the matches result will be:</p>
  
  <blockquote>
    <p>Matches:<br>
      - {{UNICORN_SERVICE_NAME}}<br>
      - {{APP_HOST}}<br>
      - {{NGINX_MAX_UPLOAD_SIZE}}<br>
      - {{GITLAB_RELATIVE_URL_ROOT}}  </p>
  </blockquote>
  
  <p>You can notice that there are 5 PlaceHolders in the file and only 4 matches.<br>
  The missing match is: <strong>{{UNICORN_SERVICE_PORT}}</strong>, because there is already another match in the same line.</p>
  
  <p><strong>My question is:</strong><br>
  How can i find all the matches in the file regardless of the line?</p>