Skip to content

Instantly share code, notes, and snippets.

@mickey24
Forked from yagays/parser.rb
Created August 19, 2010 10:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mickey24/537536 to your computer and use it in GitHub Desktop.
Save mickey24/537536 to your computer and use it in GitHub Desktop.
#/usr/bin/env ruby
def open_t_delimited_file(filename)
h = {}
open(filename) {|f|
f.each_line do |line|
a = line.split("\t")
h[a[0]] = a
end
}
puts filename + " was loaded."
h
end
if __FILE__ == $PROGRAM_NAME
b = open_t_delimited_file(ARGV[0])
open("b_hash.dump","wb") {|f|
Marshal.dump(b,f)
}
end
#/usr/bin/env ruby
open("b_hash.dump","rb") {|f|
str = Marshal.load(f)
puts str["NM_001081381"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment