J
Johnathan Smith
hello,
im new to ruby and i have a text file and want to read in the file
and print it out.
so far iv got the following. I'd greatly appreciate any help.
thanks.
text file (reference.txt):
Tag: ref1
Type: Book
Author: Little, S R
ruby file:
#!/usr/local/bin/ruby
#
#
# read file and print
#
ARGV.each do |fn|
begin
(fn == '-' ? STDIN : File.open(fn)).each_line do |l|
if $indent > 0
(1..$indent).each { print ' ' }
end
puts l
end
im new to ruby and i have a text file and want to read in the file
and print it out.
so far iv got the following. I'd greatly appreciate any help.
thanks.
text file (reference.txt):
Tag: ref1
Type: Book
Author: Little, S R
ruby file:
#!/usr/local/bin/ruby
#
#
# read file and print
#
ARGV.each do |fn|
begin
(fn == '-' ? STDIN : File.open(fn)).each_line do |l|
if $indent > 0
(1..$indent).each { print ' ' }
end
puts l
end