Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding txt to a file

Status
Not open for further replies.

shyg

Technical User
Jul 12, 2004
20
US
How do I append a line of text to a file using "cat" or some other command?

Code:
mkdir ~/tmp
cat > ~/tmp/test
cat "This text to be written to file 'test'." >> test
cat "second line of text to be added" >> test
cat "emptyline" >> test
date >> test
ls -al >> test
 
Something like this:
cat "emptyline" >> test
won't work?

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Take a look at the echo builtin:
echo "This text to be written to file 'test'." >> test

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top