LinuxQuestions.org
Visit Jeremy's Blog.
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 05-18-2004, 08:12 AM   #1
zael
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?


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

Rep: Reputation: 34
This sounds like homework....
Code:
echo "one\n two \n three\n four" > somefile
 
Old 05-18-2004, 09:09 PM   #3
seeLnd
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
seeLnd
LQ Newbie
 
Registered: May 2004
Location: Beijing, China
Distribution: Debian
Posts: 16

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


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
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 makefile.in to create a text file and write to it alix123 Programming 8 01-07-2005 08:18 AM


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