Skip to content

Instantly share code, notes, and snippets.

@headius
Created January 30, 2012 21:28
Show Gist options
  • Save headius/1706818 to your computer and use it in GitHub Desktop.
Save headius/1706818 to your computer and use it in GitHub Desktop.
require 'tempfile'
file = Tempfile.new(['','blah'])
file.open
file.write "marker lorem\n"
file.close
line = File.read(file.path)
line.sub!(/marker.*$/,'')
line.strip!
p line
END {
`rm file.path`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment