Skip to content

Instantly share code, notes, and snippets.

@akahn

akahn/shift.rb Secret

Created January 12, 2012 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save akahn/50404befabb1b9417c2d to your computer and use it in GitHub Desktop.
Save akahn/50404befabb1b9417c2d to your computer and use it in GitHub Desktop.
# "Shift" the first line off of the file
read = File.open(file)
first_line = read.gets
File.open(file, 'w') do |f|
read.each_line {|line| f.puts line }
read.close
first_line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment