[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

ruby and egrep command line

pere.noel

6/17/2006 12:14:00 PM


if from a ruby script, i do :

server="/Volumes/HDX/Users/yvon/MacSOUP_news.individual.net/individual"

nntp=`egrep -i -o --binary-files=text -e "news\.\w+\.\w+"
"#{server}/..namedfork/rsrc"`.chomp

p "nntp = " + nntp


i get "" (empty answer)


if i write a bash script "getNntpAddress.sh" with the following :

#!/bin/bash

nntp=`egrep -i -o --binary-files=text -e "news\.\w+\.\w+"
$1/..namedfork/rsrc`
echo $nntp


and use it from ruby by :

nntp=`/Users/yvon/work/RubyCocoa/MacSOUPSwitcher/map/getNntpAddress.sh
#{server}`.chomp

p "nntp = " + nntp


i get the correct answer "nntp = news.individual.net"
--
une bévue
5 Answers

Robert Klemme

6/17/2006 12:26:00 PM

0

Une bévue wrote:
> if from a ruby script, i do :
>
> server="/Volumes/HDX/Users/yvon/MacSOUP_news.individual.net/individual"
>
> nntp=`egrep -i -o --binary-files=text -e "news\.\w+\.\w+"
> "#{server}/..namedfork/rsrc"`.chomp
>
> p "nntp = " + nntp
>
>
> i get "" (empty answer)
>
>
> if i write a bash script "getNntpAddress.sh" with the following :
>
> #!/bin/bash
>
> nntp=`egrep -i -o --binary-files=text -e "news\.\w+\.\w+"
> $1/..namedfork/rsrc`
> echo $nntp
>
>
> and use it from ruby by :
>
> nntp=`/Users/yvon/work/RubyCocoa/MacSOUPSwitcher/map/getNntpAddress.sh
> #{server}`.chomp
>
> p "nntp = " + nntp
>
>
> i get the correct answer "nntp = news.individual.net"

There's really no need to call egrep from Ruby. This makes things more
complicated and less efficient than needed. Why don't you just do this:

server="/Volumes/HDX/Users/yvon/MacSOUP_news.individual.net/individual"
nntp=File.read("#{server}/..namedfork/rsrc")[/news\.\w+\.\w+/]

p "nntp = " + nntp

Kind regards

robert

pere.noel

6/17/2006 12:34:00 PM

0

Robert Klemme <bob.news@gmx.net> wrote:

> There's really no need to call egrep from Ruby. This makes things more
> complicated and less efficient than needed. Why don't you just do this:
>
> server="/Volumes/HDX/Users/yvon/MacSOUP_news.individual.net/individual"
> nntp=File.read("#{server}/..namedfork/rsrc")[/news\.\w+\.\w+/]
>
> p "nntp = " + nntp

'cause i didn't think about that solution which works great !

thanks a lot
--
une bévue

cornholio

1/13/2010 5:20:00 PM

0

On Jan 13, 6:23 am, last_permutat...@yahoo.com wrote:
> On Jan 13, 8:38 am, P-Dub <pwolf...@hotmail.com> wrote:
>
> > Israel is most certainly prepared to strike against anyone who is stupid
> > enough to attack. May God continue to give Israel strength to defend
> > against all those who would attack His people.
>
> > And may all the enemies of Israel burn for all eternity.
>
> > P-Dub: Kiss my ass, sunray.
>
> You are insane.  Thanks for sharing.
>

You're an islamotard and/or nazitard, please drown yourself
in chlorine to eliminate yourself from the gene pool.

last_permutation

1/13/2010 5:30:00 PM

0

On Jan 13, 12:20 pm, cornholio <andxor...@gmail.com> wrote:
> On Jan 13, 6:23 am, last_permutat...@yahoo.com wrote:
>
> > On Jan 13, 8:38 am, P-Dub <pwolf...@hotmail.com> wrote:
>
> > > Israel is most certainly prepared to strike against anyone who is stupid
> > > enough to attack. May God continue to give Israel strength to defend
> > > against all those who would attack His people.
>
> > > And may all the enemies of Israel burn for all eternity.
>
> > > P-Dub: Kiss my ass, sunray.
>
> > You are insane.  Thanks for sharing.
>
> You're an islamotard and/or nazitard, please drown yourself
> in chlorine to eliminate yourself from the gene pool.

Good advice. Trying it yourself might be a fine idea, cornhole.
Criminally insane ZioNazi turds always think killing solves their
many problems.

cornholio

1/14/2010 3:25:00 AM

0

On Jan 13, 9:29 am, last_permutat...@yahoo.com wrote:
> On Jan 13, 12:20 pm, cornholio <andxor...@gmail.com> wrote:
>
>
>
> > On Jan 13, 6:23 am, last_permutat...@yahoo.com wrote:
>
> > > On Jan 13, 8:38 am, P-Dub <pwolf...@hotmail.com> wrote:
>
> > > > Israel is most certainly prepared to strike against anyone who is stupid
> > > > enough to attack. May God continue to give Israel strength to defend
> > > > against all those who would attack His people.
>
> > > > And may all the enemies of Israel burn for all eternity.
>
> > > > P-Dub: Kiss my ass, sunray.
>
> > > You are insane.  Thanks for sharing.
>
> > You're an islamotard and/or nazitard, please drown yourself
> > in chlorine to eliminate yourself from the gene pool.
>
> Good advice.  Trying it yourself might be a fine idea,  cornhole.
> Criminally insane ZioNazi turds always think killing solves their
> many problems.

Unfortunately when dealing w/psychopathic islamoturds or
naziturds there really is no other choice.