Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 09-06-2008, 11:39 PM   #1
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, 08:55 AM   #2
Senior Member
Registered: Jan 2005
Location: Nottingham, UK
Distribution: Mageia 5, Linux Lite
Posts: 4,312

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

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 09:00 AM. Reason: Example added
Old 09-08-2008, 09:07 AM   #3
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:
$ 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".


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 06: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 03:36 PM
How to add a text to first line of a text file? oskeewow Linux - Newbie 6 04-23-2008 01:40 PM
how to add text to eps file? markhod Linux - General 1 07-06-2005 12:49 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:09 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration