 <p>With a lot of care and pretending that the <code>**CHANGING_NAME**</code> is well-formed:</p> <pre><code>for file in *.files; do mv -i -- "$file" "$(awk '{print $3; exit}' $file)" ; done </code></pre> <p>The -i option is to prevent accidental overriding existing files.</p> <p>This version works with spaces (and many other strange characters except for /):</p> <pre><code>for file in *.files; do mv -i -- "$file" "$(sed -n '1s/^CREATE\ PROCEDURE\ \(.*\)$/\1/p' $file)"; done </code></pre>