Created
November 29, 2011 08:53
-
-
Save ricburton/1404068 to your computer and use it in GitHub Desktop.
Kindling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=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