Hello all!
I would like to rename txt files in a folder to the last word of the first line IN the txt file.
This is what I have now:
Code:
name_check=$(cat info*.txt | head -1 | awk '{ print $NF }')
for filename in info*
do
mv $filename $name_check
done
The info*.txt are the orignal files. They originate from a api call from ovirt. So I really need to change the file names info*.txt to the server name which is located on the first line as extracted with the name_check. With all my fingers crossed :-), I hope somebody can help me out here :-)