Skip to content

Instantly share code, notes, and snippets.

@threedaymonk
Created June 12, 2023 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save threedaymonk/033fbf0487ce07e413cda1b9221b77b6 to your computer and use it in GitHub Desktop.
Save threedaymonk/033fbf0487ce07e413cda1b9221b77b6 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'csv'
require 'date'
output = CSV.new($stdout)
CSV.parse(ARGF.read.strip, headers: true).each do |row|
case row['Date']
when 'Today'
date = Date.today
when 'Yesterday'
date = Date.today - 1
else
date = Date.parse(row['Date'])
end
timestamp = date.strftime('%d/%m/%Y')
description = row['Description']
amount = row['Amount'].gsub(/,/, '')
output << [timestamp, amount, description]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment