Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-10-2008, 03:20 AM   #1
LQ Newbie
Registered: Jul 2007
Posts: 18

Rep: Reputation: 0
How to append a string to a file name?

Hi all,

I have a file named "accesslog". I have another file named "a" which contains a text string, say "Jan-10-14-29-29".

I would like to know how can I append the content of the file "a", that is "Jan-10-14-29-29" to the filename accesslog.

I am expecting an output like : "accesslogJan-10-14-29-29

Tried to do it with tr,sed etc..but couldn't. I am trying to do this within a bash script.

Thanks in advance.
Old 01-10-2008, 03:41 AM   #2
Registered: Nov 2004
Location: Novi Sad, Serbia
Distribution: Debian, Slackware, Gentoo, openSuSE
Posts: 254

Rep: Reputation: 31
mv accesslog accesslog.`cat a`
Old 01-10-2008, 08:10 PM   #3
LQ Newbie
Registered: Jul 2007
Posts: 18

Original Poster
Rep: Reputation: 0

Hi kotnik,

Thanks a lot for the reply. It works!



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Append string to end of file name chellemybelle Linux - Newbie 4 11-26-2007 07:17 PM
Append variable string(s) at end of each line schaganti Linux - Newbie 2 10-19-2007 01:31 PM
How can I append text to a string in a file HGeneAnthony Linux - Newbie 4 03-01-2007 12:16 PM
bash: append string to end of line khairil Programming 6 02-27-2007 05:09 AM
Cleanest and foolproof way to append query string to URLs (PHP) vharishankar Programming 4 07-11-2005 10:38 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:30 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration