title: How to download a file with curl -O excluding url parameters?
body: <p>I am stucked for 2 hours on a simple process because I am not confortable with bash script &amp; regex :(</p>
  
  <p>I would like to download a file using a bash script. The target file is accessible at a url with the following name pattern : </p>
  
  <pre><code>https://domain-name.com/JAWSDB_xxxxxxxxxxxxxxxxx.sql.gz?AWSAccessKeyId=XXXXXXXXXXXXXXXX&amp;Expires=xxxxxx&amp;Signature=%2XXXXXXXXXXXXXXXXXXXX
  </code></pre>
  
  <p>My first idea was to use curl -O but it creates really dirty filenames including url parameters, so I would like to only keep the following part <code>JAWSDB_xxxxxxxxxxxxxxxxx.sql.gz</code> (and remove trailing url parameters).</p>
  
  <p>I found a regex <code>.+?(?=\?)</code> that seems to remove the url prams but I don't know how to make it work with the <code>curl -O</code>command.</p>
  
  <p>Thanks a lot.</p>
  
  <p>(Ps: I am developping on osx and plan to run the script on linux)</p>