Created
August 25, 2010 20:00
-
-
Save dsanson/550174 to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
# This script converts RTF text on the OS X clipboard to HTML. | |
osascript -e 'the clipboard as «class RTF »' | \ | |
perl -ne 'print chr foreach unpack("C*",pack("H*",substr($_,11,-3)))' | \ | |
textutil -format rtf -convert html -stdin -stdout | \ | |
ruby -ne '@found=true if $_ =~ /<body>/; next unless @found; puts $_; exit if $_ =~ /<\/body>/' | \ | |
grep -v "<body>" | \ | |
grep -v "</body>" | \ | |
pbcopy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment