[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

bug in ruby or bug in my brain?

ngoc

8/9/2006 7:44:00 AM

#!/usr/bin/ruby
diff_file = File.open('diff.txt')
diff_file.each { |line|
next if line =~ /^Only/
system "dos2unix #{line.split(' and ').at(1).sub(' differ', '')}"
}
->work well

-------------------
#!/usr/bin/ruby
diff_file = File.open('diff.txt')
diff_file.each { |line|
next if line =~ /^Only/
system("dos2unix", line.split(' and ').at(1).sub(' differ', ''))
}
->problems with converting error message
3 Answers

Yukihiro Matsumoto

8/9/2006 8:01:00 AM

0

Hi,

I don't know but both caused an exception on my box by using random
diff.txt file.

In message "Re: bug in ruby or bug in my brain?"
on Wed, 9 Aug 2006 16:45:05 +0900, ngoc <ngoc@yahoo.com> writes:
|
|#!/usr/bin/ruby
|diff_file = File.open('diff.txt')
|diff_file.each { |line|
| next if line =~ /^Only/
| system "dos2unix #{line.split(' and ').at(1).sub(' differ', '')}"
|}
|->work well
|
|-------------------
|#!/usr/bin/ruby
|diff_file = File.open('diff.txt')
|diff_file.each { |line|
| next if line =~ /^Only/
| system("dos2unix", line.split(' and ').at(1).sub(' differ', ''))
|}
|->problems with converting error message

ngoc

8/9/2006 8:42:00 AM

0

Yukihiro Matsumoto wrote:
> Hi,
>
> I don't know but both caused an exception on my box by using random
> diff.txt file.
My box is Redhat Enterprise Workstation 3.0
Ruby 1.6.8 is already installed in Redhat

My diff.txt is generated when using diff command in linux.
Its output is: Files catalogue_1/A.txt and catalogue_2/A.txt differ
So I use Ruby to pick "catalogue_2/A.txt" out of that string and convert
the file to unix format. (A.txt from server is downloaded to a linux and
a windows machine, after that I want to check A.txt is the same. But it
differs because linux and windows has different ending. So I have to
convert windows ending to unix ending).
>
> In message "Re: bug in ruby or bug in my brain?"
> on Wed, 9 Aug 2006 16:45:05 +0900, ngoc <ngoc@yahoo.com> writes:
> |
> |#!/usr/bin/ruby
> |diff_file = File.open('diff.txt')
> |diff_file.each { |line|
> | next if line =~ /^Only/
> | system "dos2unix #{line.split(' and ').at(1).sub(' differ', '')}"
> |}
> |->work well
> |
> |-------------------
> |#!/usr/bin/ruby
> |diff_file = File.open('diff.txt')
> |diff_file.each { |line|
> | next if line =~ /^Only/
> | system("dos2unix", line.split(' and ').at(1).sub(' differ', ''))
> |}
> |->problems with converting error message
>

Nobuyoshi Nakada

8/9/2006 2:16:00 PM

0

Hi,

At Wed, 9 Aug 2006 16:45:05 +0900,
ngoc wrote in [ruby-talk:207244]:
> #!/usr/bin/ruby
> diff_file = File.open('diff.txt')
> diff_file.each { |line|
> next if line =~ /^Only/
line.chomp!
> system("dos2unix", line.split(' and ').at(1).sub(' differ', ''))
> }

--
Nobu Nakada