Is it possible to access the Clipboard as a file from the command line?
You can read and write to the Pasteboard with the Terminal commands pbcopy and pbpaste. So to edit it you could use something like

pbpaste &gt; /tmp/clip.txt &amp;&amp; vi /tmp/clip.txt &amp;&amp; pbcopy &lt; /tmp/clip.txt


If you need it often, a shell function might be better suited. You can define one by putting the following into your .bashrc

pbedit() {
    local _t=$(mktemp)
    chmod 600 "$_t"

    pbpaste &gt; "$_t"
    ${EDITOR:-vi} "$_t"
    pbcopy &lt; "$_t"

    rm -f "$_t"
}


This tries to minimize the risk of other people accessing the temporary file while editing (but can't prevent anybody with admin or root priviledges from access).