LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 09-06-2008, 10:39 PM   #1
newbiebash
LQ Newbie
 
Registered: Sep 2008
Posts: 1

Rep: Reputation: 0
what is the command to add text into a text file?


what is the command to add text into a text file?

anyone tell me?
 
Old 09-08-2008, 07:55 AM   #2
{BBI}Nexus{BBI}
Senior Member
 
Registered: Jan 2005
Location: Nottingham, UK
Distribution: Mageia 4
Posts: 4,297

Rep: Reputation: 205Reputation: 205Reputation: 205
It's cat >> (name of file here) (text you want to add here) press ^D (Control D) when you're done.

Example:
Code:
cat >> shoppinglist.txt must buy some champagne ^D
Adds the highlighted text to an existing file called shoppinglist.txt

Last edited by {BBI}Nexus{BBI}; 09-08-2008 at 08:00 AM. Reason: Example added
 
Old 09-08-2008, 08:07 AM   #3
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
Alternately, you could also go:
Code:
$ echo "oranges, bananas, eggs, bacon" >> shoppinglist.txt
Note that this will append the text to the end of the file. If you only use one ">" you will clear the file, and will only see "oranges, bananas, eggs, bacon".
 
  


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
simple php script to add line/file to text file dnoy Programming 1 05-21-2008 05:08 PM
How to parse text file to a set text column width and output to new text file? jsstevenson Programming 12 04-23-2008 02:36 PM
How to add a text to first line of a text file? oskeewow Linux - Newbie 6 04-23-2008 12:40 PM
how to add text to eps file? markhod Linux - General 1 07-05-2005 11:49 PM


All times are GMT -5. The time now is 09:06 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