Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 23rd March 2009, 03:26 PM
cola Offline
Registered User
 
Join Date: Sep 2007
Location: Dhaka,Bangladesh
Posts: 390
Copying file contens to another file using echo command

Hi,
Can anyone tell how to copy file contents to another blank text file using echo command?
__________________
fedora
Reply With Quote
  #2  
Old 23rd March 2009, 08:48 PM
Ashish Sood's Avatar
Ashish Sood Offline
Registered User
 
Join Date: Feb 2009
Location: Gwalior
Posts: 153
try this
echo filename1>filename2
Reply With Quote
  #3  
Old 24th March 2009, 12:58 AM
RupertPupkin's Avatar
RupertPupkin Offline
Registered User
 
Join Date: Nov 2006
Location: Detroit
Posts: 4,722
Quote:
Originally Posted by Ashish Sood View Post
try this
echo filename1>filename2
No. That would make the file called filename2 consist of a single line of text, that text being "filename1" (minus the quotes). That is, it echoes the file's name, not the file's contents.

You could use cat instead: cat filename1 > filename2

If you insist on using echo, then you'll need to loop through each line of the first file. For example:
Code:
while read -r line
do
   echo "$line" >> filename2
done < filename1
Reply With Quote
  #4  
Old 25th March 2009, 12:36 PM
cola Offline
Registered User
 
Join Date: Sep 2007
Location: Dhaka,Bangladesh
Posts: 390
Thanks RupertPupkin
__________________
fedora
Reply With Quote
Reply

Tags
command, contens, copying, echo, file

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
'File too large' when copying 6.3GB file from ext3 to USB arun_maurya Using Fedora 4 8th December 2008 11:24 AM
copying one file to multiple directories. Utterlynoobish Using Fedora 0 27th November 2008 10:01 PM
copying file from vmware ilbh Using Fedora 1 2nd June 2006 09:54 AM
copying file over from FC3 to FC4 fedoracorebeast EOL (End Of Life) Versions 1 23rd July 2005 07:01 PM


Current GMT-time: 18:16 (Wednesday, 19-06-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat