LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   what is the command to add text into a text file? (http://www.linuxquestions.org/questions/programming-9/what-is-the-command-to-add-text-into-a-text-file-668070/)

newbiebash 09-06-2008 10:39 PM

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?

{BBI}Nexus{BBI} 09-08-2008 07:55 AM

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

indienick 09-08-2008 08:07 AM

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".


All times are GMT -5. The time now is 09:03 PM.