[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Rethinking the Generic Ruby Oneliner...

John Carter

3/25/2007 10:17:00 PM

3 Answers

Paul Stickney

3/25/2007 10:55:00 PM

0

Maybe:
>> ruby -rmylibrary -e "replaceString" -- --find startPath --matching
pathRegex -i.bak --gsub searchRegex

If that's too long, maybe a shell/program wrapper ^^
>> myruby --find startPath --matching pathRegex -i.bak --gsub
searchRegex -e "replaceString"

I like magic best when I can tear it apart -- and you have all the
tools now to put it to the test.


Paul

Brian Candler

3/26/2007 6:00:00 AM

0

On Mon, Mar 26, 2007 at 07:55:05AM +0900, Paul Stickney wrote:
> Maybe:
> >>ruby -rmylibrary -e "replaceString" -- --find startPath --matching pathRegex -i.bak --gsub searchRegex
>
> If that's too long, maybe a shell/program wrapper ^^
> >>myruby --find startPath --matching pathRegex -i.bak --gsub searchRegex -e "replaceString"

If you call it x.rb then you can have ruby -rx ...

Robert Klemme

3/30/2007 7:00:00 AM

0

On 26.03.2007 08:00, Brian Candler wrote:
> On Mon, Mar 26, 2007 at 07:55:05AM +0900, Paul Stickney wrote:
>> Maybe:
>>>> ruby -rmylibrary -e "replaceString" -- --find startPath --matching pathRegex -i.bak --gsub searchRegex
>> If that's too long, maybe a shell/program wrapper ^^
>>>> myruby --find startPath --matching pathRegex -i.bak --gsub searchRegex -e "replaceString"
>
> If you call it x.rb then you can have ruby -rx ...

Or create a shell script ("rubyfind") that does the command line
parameter interpretation. You could even implement the shell script in
ruby making your life much easier. :-)

Kind regards

robert