Created
August 23, 2016 04:48
-
-
Save meetupwayne/4f1d5a6298224761367955e486db0e09 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print ("Enter file name: ") | |
fname = gets.strip() | |
fname = "mbox-short.txt" if (fname.length < 1) | |
fh = open(fname) | |
count = 0 | |
fh.readlines.each do |line| | |
if line.start_with?('From') and not line.start_with?('From:') then | |
puts line.split()[1] | |
count+= 1 | |
end | |
end | |
puts("There were, #{count}, lines in the file with From as the first word") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment