title: bulk rename pdf files with name from specific line of its content in linux
body: <p>I have multiple <code>pdf</code> files which I want to rename. new name should be taken from pdf's file content on specific(lets say 5th) line. for example, if file's 5th line has content <code>some string</code> &lt;-- this string should be name of file. and same thing goes to the rest of files. each file should be renamed with content's 5th line. I tried this in terminal</p>
  
  <pre><code>for pdf in *.pdf
  do
     filename=`basename -s .pdf "${pdf}"`
     newname=`awk 'NR==5' "${filename}.pdf"`
     mv "${pdf}" "${newname}"
  done
  </code></pre>
  
  <p>it copies the files, but name is invalid string. I know the system doesn't see the file as plain text and images, there are metadata, xml tags and so on.. but is there way to take content from that line?</p>