I have many files in directory (
Every files contains bunch of lines. One of the line is specific text
thetext followed by random number just like
I want to rename beginning of the file name using specific text in the file itself. So,
file1.txt will be
file2.txt will be
thetextXXfile2.txt, and so on.
Simple rename command to add
addtext on the beginning is
rename 's?^?addtext?' *.html
while getting that specific text in the files is
sed '/thetext/!d' *.html
but I have no idea how to combine both of them.