From: Yitzhak Bar Geva Date: 2007-06-13T06:32:04+09:00 Subject: Re: Quick sed replacemnt ------=_Part_14614_26562565.1181683924785 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Very nice. Thanks indeed! 2007/6/12, Felix Windt : > > ruby -e 'puts $_.gsub(/(class )(.)/) { "#{$1}#{$2.upcase}" }' -n > [filename] > > very dirty > > > -----Original Message----- > > From: yitzhakbg [mailto:yitzhakbg@gmail.com] > > Sent: Tuesday, June 12, 2007 12:26 PM > > To: ruby-talk ML > > Subject: Re: Quick sed replacemnt > > > > Sorry, You didn't understand. The class name can be anything. Whatever > > it is, I want the first changed to upper case. If you can show me how > > to do it in Sed, that's fine. I found it messy and tried writing a > > Ruby script. It also came out a little messy. Can you help me? > > > > On Jun 12, 10:20 pm, Reid Thompson wrote: > > > On Wed, 2007-06-13 at 04:14 +0900, yitzhakbg wrote: > > > > I need a quicky which I can't do in sed and I did it very clumsily. > > > > I need to filter the following file, changing the class name's first > > > > letter to upper case. > > > > For example, rewrite the file with the word > "organizationsController" > > > > changed to "OrganizationsController". > > > > Thanks. > > > > > > > Here's a sample file: > > > > > > > # > > > > # A skeletal controller > > > > # > > > > class organizationsController < ApplicationController > > > > active_scaffold :organization > > > > # layout "activescaffold" > > > > end > > > > > > sed 's/organizationsController/OrganizationsController/' file > > newfile > > > ------=_Part_14614_26562565.1181683924785--