diff options
Diffstat (limited to 'script mutt to plain text note.txt')
-rwxr-xr-x | script mutt to plain text note.txt | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/script mutt to plain text note.txt b/script mutt to plain text note.txt new file mode 100755 index 0000000..7e1a99c --- /dev/null +++ b/script mutt to plain text note.txt @@ -0,0 +1,72 @@ +script- mutt to plain text note + +tags: nvalt gtd +date: January 24, 2013 19:03:28 PM +--- + + +Subject: Re: Your Mutt Scripts... + +Hi Scott, + +Thanks for your nice message, and glad you found the posts useful. +Here's the script I use, which is somewhat geared towards my +idiosyncratic "2q" system: + + + #!/bin/sh + # $HOME/Scripts/m2q + BODY=$(sed -n '/^Date/,$ p' | grep -E -i '^[^X]+' | sed -En '/^Date/,/application\// p') + TITLE="2q $1" + echo "${BODY}" | sed -En '/^Date/,/text\/html/ p' > /Users/wcm1/Dropbox/notes/"$TITLE".txt + echo "${BODY}" | sed -En '/text\/html/,$ p' | pandoc --strict -f html -t markdown >> $HOME/Dropbox/notes/"$TITLE".txt + + +It's actually a very imperfect filter. The sed command in the BODY +variable is clumsy and designed mainly to clear out gobbledy-gook from +attachments. I use the other echo commands to print both the +plain-text version of the message and the HTML version (if there is +one) parsed by pandoc to my note. +Within put, I use the | key to call the pipe message command, and then +I enter: + m2q "Title of my note" +and hit enter (the Script is called m2q and resides in my $PATH). +You should be able to see how to make an even simpler script, though. +If all you wanted to do was be able to give your note a title within +Mutt, your script could look like this: +``` +MESSAGE=$(cat) +TITLE="$1" +echo "${MESSAGE}" > path/to/notes/"$1".txt +``` +Hope this helps, +Caleb +W. Caleb McDaniel +Assistant Professor of History +Rice University +http://wcm1.web.rice.edu +On Wed, Jan 23, 2013 at 04:54:49PM -0500, Scott Gilbertson wrote: +> Caleb- +> +> I stumbled across your site trying to perfect my GTD-in-plain-text +> system. I like what you wrote about regarding notational velocity, it's +> very similar to what I do. +> +> What I was writing about though is your mutt post. This bit about saving +> messages as plain text files caught my eye: "I wrote up a simple script +> that takes the message, cleans it up, and puts it in a plain text file +> whose title I specify within Mutt." +> +> I was wondering if you'd be willing to share that script? +> +> What I'm doing right now is just putting <pipe-message> in my muttrc and +> passing it to cat to saving the file in my notes folder. But I like the +> idea of giving it a title and everything right in mutt. I just can't +> seem to get that to work for me. +> +> Anyway, thanks for your time. +> +> cheers +> Scott Gilbertson +> sng@luxagraf.net +> |