Hi there,
Is there a possibility to count the lines in a file with ruby?
Any anwer would be very helpful.
Thanks
Gustav
Hi there,
Is there a possibility to count the lines in a file with ruby?
Any anwer would be very helpful.
Thanks
Gustav
count.rb
lines = 0
ARGF.each do |line|
lines += 1
end
Run it as:
ruby count.rb file …
Gavin
On Monday, February 17, 2003, 12:44:02 PM, Gustav wrote:
Hi there,
Is there a possibility to count the lines in a file with ruby?
How about this.
open(“filename”){|f| p f.readlines.size}
Shin
Hi there,
Is there a possibility to count the lines in a file with ruby?
Any anwer would be very helpful.
Thanks
Gustav
Hi there,
Is there a possibility to count the lines in a file with ruby?
count.rb
lines = 0
ARGF.each do |line|
lines += 1
end
puts lines
On Monday, February 17, 2003, 12:51:50 PM, Gavin wrote:
On Monday, February 17, 2003, 12:44:02 PM, Gustav wrote:
Run it as:
ruby count.rb file …
Gavin
Shin Nishiyama shin@xtal.tf.chiba-u.ac.jp wrote in message news:200302171108.BDF62789.IOTJ@xtal.tf.chiba-u.ac.jp…
How about this.
open(“filename”){|f| p f.readlines.size}
Shin
Hi there,
Is there a possibility to count the lines in a file with ruby?
Any anwer would be very helpful.
Thanks
Gustav
Very nice.
Thanks a lot.
Shin Nishiyama shin@xtal.tf.chiba-u.ac.jp wrote in message news:200302171108.BDF62789.IOTJ@xtal.tf.chiba-u.ac.jp…
How about this.
open(“filename”){|f| p f.readlines.size}
Shin
[...]
Very nice.
Thanks a lot.
Not forgetting:
ruby -ne ‘END {puts $.}’ file
from
Hugh
On Mon, 17 Feb 2003, Gustav G. wrote: