A
Amit Tomar
Hi all,
I would like to know how do i split a file by newline ,am
able to do it tab space like
path="E:/expr/amit.txt"
File.open(path).each do |i|
k=i.split("\t" )
puts "#{k[0]}"
end
o/p: amit
and this is content of my file(amit.txt)
amit sumit
now i changed content of file like
amit
sumit
path="E:/expr/amit.txt"
File.open(path).each do |i|
k=i.split("\n" )
puts "#{k[0]}"
end
i should get amit only but am getting
amit
sumit
how do i make them split from newline??
I would like to know how do i split a file by newline ,am
able to do it tab space like
path="E:/expr/amit.txt"
File.open(path).each do |i|
k=i.split("\t" )
puts "#{k[0]}"
end
o/p: amit
and this is content of my file(amit.txt)
amit sumit
now i changed content of file like
amit
sumit
path="E:/expr/amit.txt"
File.open(path).each do |i|
k=i.split("\n" )
puts "#{k[0]}"
end
i should get amit only but am getting
amit
sumit
how do i make them split from newline??