title: (unix shell scripting) Unzip multiple zip files, rename unzipped file following zip file name
body: <p>I have multiple zip files like this example:</p>
  
  <pre><code>759198298412.zip
  ----i love you.pdf
  ----forever and one.txt
  ----today and tomorrow.docs
  48891721241592__5123.zip
  ----whatever it is.pdf
  5717273_616.zip
  ----igotit.txt
  ----thank you very much.mp3    
  </code></pre>
  
  <p>I am trying to make a script to unzip the zip files, and rename the unzipped files to the zip file name. like this output:</p>
  
  <pre><code>759198298412.pdf
  759198298412.txt
  759198298412.docs
  
  48891721241592__5123.pdf
  
  5717273_616.txt
  5717273_616mp3
  </code></pre>
  
  <p>I found this script below, but it doesn't work for me because my files have space and i have multiple files in a zip file.</p>
  
  <pre><code>for i in *.zip
  do 
  n=$(unzip -lqq $i | awk '{print $NF}')
  e=${n#*.}
  unzip $i &amp;&amp; mv $n ${i%%_*}".$e"
  done    
  </code></pre>
  
  <p>Please help! thank you</p>