Newbie: add few lines to file ..?

N

newman

Hi!

I try to write code which adding extra lines to my file

ruby -e 'readlines.each{.......... } ' myfile_name~ > myfile_name

How to make it. I should use readlines...?
 
L

Lee Jarvis

Yeah, as 7stud says, open the file with the append flag..

You should look through the docs of the File class, and possibly
Google? They're suprisingly useful..

Regards,
Lee
 
S

Sebastian Hungerecker

newman said:
I try to write code which adding extra lines to my file

ruby -e 'readlines.each{.......... } ' myfile_name~ > myfile_name

Replace the > with a >> and the output of your script will be appended to
myfile_name instead of replacing it.

HTH,
Sebastian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top