How to rename a file with a name from another file

Hello Experts...

I have a requirement to rename a file using the file name stored in another file. I browsed thru forums and found this for renaming multiple files.

 
awk '{f=$1;sub("-.*\\.","_"$2".",$1);system("mv "f" "$1)}' file-with-filenames
 

But, My requirement is to rename a single file and I dont know how to edit the available command without messing up :wall:

Case scenario
1)Filename.txt
File1_renamed

2)I need to read the file Filename.txt and rename the File1.txt to File1_renamed.txt

Can someone throw some light on how to do this? Your help will be much appreciated!! Thanks

mv file1.txt $(xargs <Filename.txt)
mv file1.txt $(head -1 Filename.txt)

one way:

#  mv File1.txt $(sed q Filename.txt)

Thanks for the commands...

I got one more similar requirement to rename a file by appending a value from other file. I know it would be a simple modification to these commands but my unix knowledge did not help me....Can you please show me a way to do this....

Say

File_Date.txt contain a value 20110710

Now, I want to rename a file File1.txt to File1_20110710.txt

Your help is much appreciated!!!

---------- Post updated 06-07-11 at 12:19 AM ---------- Previous update was 05-07-11 at 07:32 AM ----------

Hi.. Many thanks for the commands...

I got slight change in the requirement to rename a file by appending a value from other file. I know it would be a simple modification to these commands but my unix knowledge did not help me....Can you please guide me to do this....

Scenario....

File_Date.txt contain a value 20110710

Now, I want to rename a file File1.txt to File1_20110710.txt

Your help is much appreciated!!!

Does File_Date.txt contain the date value in its first line ?
If not, please give us an example of File_Date.txt content.

File_Date.txt will have only one date value in the format YYYYMMDD

ex.,

20110706

I need to append this date to the name of other file already exists in the directory.

ex.,
File_Date.txt
File1.txt

I need to read the content(date value in yyyymmdd) from File_Date.txt and rename File1.txt by appending the date value, which should look like File1_20110706.txt

I managed to get it work with

mv File.txt $echo File1_$(head -1 File_Date.txt).txt

But, I would appreciate if you could suggest any better approach

give a try with double quote

mv File.txt "File1_$(head -1 File_Date.txt).txt"

A better approach would have been to have stored the date into a variable instead of into a file