LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices

Reply
 
Search this Thread
Old 01-10-2008, 03:20 AM   #1
anandkj
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.
anand
 
Old 01-10-2008, 03:41 AM   #2
kotnik
Member
 
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
anandkj
LQ Newbie
 
Registered: Jul 2007
Posts: 18

Original Poster
Rep: Reputation: 0
Thanks

Hi kotnik,

Thanks a lot for the reply. It works!

cheers!
anand
 
  


Reply


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


All times are GMT -5. The time now is 03:40 AM.

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