Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 05-18-2004, 08:12 AM   #1
LQ Newbie
Registered: Aug 2003
Posts: 26

Rep: Reputation: 15
Create text file with a script

Can anyone point me in the right direction. I would like to create a script that creates a text file with 4 lines of text. Does any one know how i can accomplishe this?

Old 05-18-2004, 09:03 AM   #2
jim mcnamara
Registered: May 2002
Posts: 964

Rep: Reputation: 36
This sounds like homework....
echo "one\n two \n three\n four" > somefile
Old 05-18-2004, 09:09 PM   #3
LQ Newbie
Registered: May 2004
Location: Beijing, China
Distribution: Debian
Posts: 16

Rep: Reputation: 0
It can accomplish this. but it's ugly, I cannot find how to do this for the best:

echo "one@two@three@four" | tr '@' '\n' > file
Old 06-02-2004, 03:27 AM   #4
LQ Newbie
Registered: May 2004
Location: Beijing, China
Distribution: Debian
Posts: 16

Rep: Reputation: 0
echo -e "one\ntwo\nthree\nfour" >file


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
How to create log file from script fotoguy Programming 12 03-27-2012 06:39 AM
create text file from terminal acidjuice Linux - Software 8 09-03-2010 03:46 AM
How to find and change a specific text in a text file by using shell script Bassam Programming 1 07-18-2005 07:15 PM
Create a text file using Bash Boffy Programming 5 03-14-2005 09:06 PM
Linux shell command for to create a text file and write to it alix123 Programming 8 01-07-2005 08:18 AM > Forums > Non-*NIX Forums > Programming

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