Skip to content

Instantly share code, notes, and snippets.

@ricburton
Created November 29, 2011 08:53
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 ricburton/1404068 to your computer and use it in GitHub Desktop.
Save ricburton/1404068 to your computer and use it in GitHub Desktop.
Kindling
=begin
The Kindle clippings are each accompanied with a lot of useful information. However, when you're scanning over them it can get annoying to keep seeing them formatted as such:
the mystical process of extracting value (money) from idle IP assets
==========
Essentials of Licensing Intellectual Property (Alexander I. Poltorak, Paul J. Lerner)
- Highlight on Page 16 | Added on Friday, 25 November 11 10:42:19 Greenwich Mean Time
The script below is a tiny bit of ruby that will strip out all the dross and leave behind:
the mystical process of extracting value (money) from idle IP assets
Sweet! Just save the script and your "myclips.txt" file into a folder, navigate to the folder using the cd command in terminal and enter the following: "ruby strip.rb"
Happy days.
=end
myclips = "myclips.txt"
contents = File.open(myclips) { |f| f.read }
newcontents = contents.gsub(/==========(.*?)Time/m,"")
newfile = "UHAveStripped" + myclips
File.open( newfile, 'w') do |f|
f << newcontents
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment