From mboxrd@z Thu Jan 1 00:00:00 1970 From: Johann Spies Subject: Re: sh - script: how to control the output. Date: Mon, 2 Nov 2015 15:00:45 +0200 Message-ID: References: <877fm0d5pm.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a114067b08c78e005238e5d66 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46785) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtEjA-0000k5-1L for emacs-orgmode@gnu.org; Mon, 02 Nov 2015 08:00:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZtEj8-000542-RN for emacs-orgmode@gnu.org; Mon, 02 Nov 2015 08:00:47 -0500 Received: from mail-lf0-x22f.google.com ([2a00:1450:4010:c07::22f]:36011) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtEj8-00053s-94 for emacs-orgmode@gnu.org; Mon, 02 Nov 2015 08:00:46 -0500 Received: by lffz202 with SMTP id z202so61407956lff.3 for ; Mon, 02 Nov 2015 05:00:45 -0800 (PST) In-Reply-To: <877fm0d5pm.fsf@gmail.com> 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Cc: emacs-orgmode@gnu.org --001a114067b08c78e005238e5d66 Content-Type: text/plain; charset=UTF-8 > > You could try out some of the options for the ":results" header > argument, as described here: > > http://orgmode.org/manual/results.html#results > > > Thanks Myles. After a bit of experimenting I got this to work (I have to remove the *example* lines to make a table of the output. But that is OK. #+BEGIN_SRC sh :results verbatim #!/bin/sh echo "\d wos.za_wos_subject_percent_v" | psql -h localhost -p 63334 book_citation | sed '1,2d' | \ sed '/[|+]/s/^/|/'| sed -e '/[|+]/s/$/|/' #+END_SRC #+results: #+begin_example View "wos.za_wos_subject_percent_v" | Column | Type | Modifiers | |---------------+---------+-----------| | id | integer | | | subject | citext | | | pubyear | integer | | | sa_papers | numeric | | | world_papers | bigint | | | za_percentage | real | | | rest | real | | #+end_example Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) --001a114067b08c78e005238e5d66 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

=

You could try out some of the options for the ":results" h= eader
argument, as described here:

http://orgmode.org/manual/results.html#results



Thanks Myles.=C2=A0 Afte= r a bit of experimenting I got this to work (I have to remove the *example*= =C2=A0 lines to make a table of the output.=C2=A0 But that is OK.
=C2=A0=

#+BEGIN_SRC sh :results verbatim
#!/bin/sh
echo "\d wos.= za_wos_subject_percent_v" | psql -h localhost -p 63334 book_citation |= sed '1,2d' | \
sed '/[|+]/s/^/|/'| sed -e '/[|+]/s/= $/|/'

#+END_SRC

#+results:
#+begin_example
=C2=A0Vi= ew "wos.za_wos_subject_percent_v"
|=C2=A0=C2=A0=C2=A0 Column= =C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 Type=C2=A0=C2=A0 | Modifiers |
|-------= --------+---------+-----------|
| id=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | integer | |
| subject=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 | citext=C2=A0 | |
| pubyear=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 | integer | |
| sa_papers=C2=A0=C2=A0=C2=A0=C2=A0 | numeric= | |
| world_papers=C2=A0 | bigint=C2=A0 | |
| za_percentage | real= =C2=A0=C2=A0=C2=A0 | |
| rest=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 | real=C2=A0=C2=A0=C2=A0 | |

#+end_example

Regards
Johann

--
Because experiencing your loyal love is be= tter than life itself,
my lips will praise you.=C2=A0 (Psalm 63:3)
<= /div>
--001a114067b08c78e005238e5d66--