From mboxrd@z Thu Jan 1 00:00:00 1970 From: stardiviner Subject: Re: How to pass shell command result to :post source-block? Date: Sat, 19 Jan 2019 17:20:23 +0800 Message-ID: <87va2lovfs.fsf@gmail.com> References: <87y37hcpq9.fsf@gmail.com> <87a7jx3udb.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me> Reply-To: numbchild@gmail.com Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([209.51.188.92]:45150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gkmkq-0007Af-Dn for emacs-orgmode@gnu.org; Sat, 19 Jan 2019 04:17:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gkmkp-0002dC-Li for emacs-orgmode@gnu.org; Sat, 19 Jan 2019 04:17:28 -0500 Received: from [61.175.244.13] (port=49054 helo=dark.localdomain) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gkmkp-0002Ys-5q for emacs-orgmode@gnu.org; Sat, 19 Jan 2019 04:17:27 -0500 In-reply-to: <87a7jx3udb.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Ihor Radchenko Cc: Org Mode Ihor Radchenko writes: > See the code below: > > #+NAME: ansi-escape-filter > #+begin_src emacs-lisp :var data="" > (with-temp-buffer > (insert data) > (ansi-color-apply-on-region (point-min) (point-max)) > (buffer-string)) > #+end_src > > #+RESULTS: ansi-escape-filter > > #+begin_src sh :dir /sudo:: :results output :post ansi-escape-filter(data=*this*) > tree /var/spool/postfix/ > #+end_src > > `:results output` is needed to avoid parsing the shell output as a > table. > `data=*this*` is needed to pass the output to `ansi-escape-filter`. You > can also check the example in the org info page for the :post header > argument. > > > Best, > Ihor > Thanks for your detailed explanation. After your hint, I just checked out =org-manual.org= about the Post-processing :post example. It's a good example. -- [ stardiviner ] I try to make every word tell the meaning what I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3