From: Josh Cheek Date: 2012-01-07T20:28:58+09:00 Subject: Re: one liner to insert line in a file --f46d043d66d95f4d4904b5ee7886 Content-Type: text/plain; charset=ISO-8859-1 On Sat, Jan 7, 2012 at 1:34 AM, Neubyr Neubyr wrote: > Got it: > $ ruby -i -pe 'print "First Line\n" if $.==1' filename.txt > > Thanks! > > -- > Posted via http://www.ruby-forum.com/. > > Love this! (btw, you can use `puts` instead of `print "...\n"`) Downside is it doesn't work on multiple files since Ruby's $. doesn't reset for each file (not sure why not). --f46d043d66d95f4d4904b5ee7886--