Skip to content

Instantly share code, notes, and snippets.

@avescodes
Created November 29, 2009 03:12
Show Gist options
  • Save avescodes/244774 to your computer and use it in GitHub Desktop.
Save avescodes/244774 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
filename = ARGV.shift
lines = []
File.open(filename, 'r') do |f| # open file for update
lines = f.readlines # read into array of lines
lines.each do |it| # modify lines
it.gsub!(/;.*/, '')
end
end
File.open("stripped-"+filename, 'w') do |f|
f.print lines # write out modified lines
f.truncate(f.pos) # truncate to new length
end # file is automatically closed
puts `./assembler stripped-#{filename}`
`mv stripped-#{filename.gsub('asm','o')} #{filename.gsub('asm','o')}`
`rm stripped-#{filename}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment