From: Admin Tensor Date: 2012-08-13T02:49:44+09:00 Subject: Re: Delete a lines from a files Robert Klemme wrote in post #1072081: > If you really only need to delete a single line from a file sed is > probably the easiest choice: > > without backup > $ sed -i '/^john/ d' your_file > > with backup > $ sed -i.bak '/^john/ d' your_file > > Kind regards > > robert Hi, I think because this discussion is about Ruby and the OP may or may not have access to sed, we can follow Dave Thomas' way on the command line: ruby -e 'BEGIN{$/=nil}; puts STDIN.readlines.to_s.gsub(/^john.*$/, "")' < your_file I haven't tried the code myself yet, so it has to be taken with a grain of salt; and as written, it only outputs to stdout. Regards, Bill -- Posted via http://www.ruby-forum.com/.