I\'m processing huge data files (millions of lines each).
Before I start processing I\'d like to get a count of the number of lines in the file, so I can then indic
Same as DJ's answer, but giving the actual Ruby code:
count = %x{wc -l file_path}.split[0].to_i
The first part
wc -l file_path
Gives you
num_lines file_path
The split and to_i put that into a number.
split
to_i