Rename txt files using the frst line of the content as name

Hi there,
I have thousands of files that i need to rename. They are in .txt format. I want the first line of the content of the file as title of the txt file. Plz help
Example: I have poems in text (.txt) files but names are not correct. I want the first line of the content as the title of the txt files.
Plz let me know. Thanks in advance......
I have thousands of files that i need to rename. They are in .txt format. I want the first line of the content of the file as title of the txt file. Plz help
Example: I have poems in text (.txt) files but names are not correct. I want the first line of the content as the title of the txt files.
Plz let me know. Thanks in advance......