On 12.06.2007 21:14, 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
> 
> 
10:02:47 [Temp]: cat x
#
# A skeletal controller
#
class organizationsController < ApplicationController
   active_scaffold :organization
   #  layout "activescaffold"
   end

10:03:46 [Temp]: ruby -i.bak -pe 'gsub(/\bclass\s+(\w+)\b/) {"class " << 
$1.capitalize}' x
10:04:25 [Temp]: cat x
#
# A skeletal controller
#
class Organizationscontroller < ApplicationController
   active_scaffold :organization
   #  layout "activescaffold"
   end


10:04:27 [Temp]:

Kind regards

	robert