← Back to team overview

zim-wiki team mailing list archive

Re: tip: Zim to capture command line output

 

On Sat, Jan 14, 2012 at 17:26, Rolf Kleef <rolf@xxxxxxxxxxx> wrote:
> Sharing this, maybe useful for others:
>
> I'm doing a lot of work from the command line in Linux, and often want
> to capture the output of a command and be able to at it look at it later
> (eg. to compare with earlier results, or to process line by line).
>
> It struck me that Zim could help me avoid "select-copy-paste" cycles,
> and just capture things in a note. I eventually crafted an alias that:
>
> - captures stdout but also still displays it (allows further processing)
> - adds a timestamp before the output sent to Zim
> - adds ''' before and after the output, to format it as "verbatim"
> - appends it to the note "stdout" in the default Notebook
>
> alias z="tee >( cat <(date) <(echo \'\'\') - <(echo \'\'\') | zim
> --plugin quicknote input=stdin namespace=stdout )"
>
> It's easy to capture anything by just adding "| z" at the end:
>
>        ls -la | z
>
> You'll still need to click ok "accept" the note, but it's easier than
> scrolling back and forth to select the output.
>
> You could even use it to capture intermediate results when piping
> through several commands:
>
>        ls -la | z | grep 2012 | z | wc
>

Nice. I suppose that a -y flag to suppress the OK button might be feasible.


-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com


References