Skip to content

Instantly share code, notes, and snippets.

@jibing57
Last active July 27, 2016 08:27
Show Gist options
  • Save jibing57/dd339bd792bb5e1be4deac3b7155326e to your computer and use it in GitHub Desktop.
Save jibing57/dd339bd792bb5e1be4deac3b7155326e to your computer and use it in GitHub Desktop.
# change file extension
input_file="./xxx.log"
output_file= "#{input_file.chomp(File.extname(input_file))}.csv"
puts "input_file is #{input_file}, output_file is #{output_file}"
# get first line of files
input_file="./xxx.log"
first_line = File.open(src_file, "r") {|f| f.readline}
puts "first_line of file[#{input_file}] is #{first_line}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment