emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* sh - script: how to control the output.
@ 2015-11-02  7:35 Johann Spies
  2015-11-02 11:02 ` Myles English
  0 siblings, 1 reply; 3+ messages in thread
From: Johann Spies @ 2015-11-02  7:35 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1190 bytes --]

In the normal shell, I can do:

 echo '\d wos.wos_papers_by_subject_mv' | psql -h localhost -p 63334
book_citation | grep '[+|]'

and get the output:

  Column  |  Type   | Modifiers
----------+---------+-----------
 id       | integer |
 subject  | citext  |
 articles | bigint  |

When I try this in org-mode:


#+BEGIN_SRC sh

echo '\d wos.wos_papers_by_subject_mv' | psql -h localhost -p 63334
book_citation | grep '[+|]'


#+END_SRC

#+results:
| Column                           |   |   | Type    |   |   | Modifiers |
| ----------+---------+----------- |   |   |         |   |   |           |
| id                               |   |   | integer |   |   |           |
| subject                          |   |   | citext  |   |   |           |
| articles                         |   |   | bigint  |   |   |           |

What should I do to get the following in org-mode as a result:

| Column   | Type    | Modifiers |
|----------+---------+-----------|
| id       | integer |           |
| subject  | citext  |           |
| articles | bigint  |           |


Regards
Johann
-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

[-- Attachment #2: Type: text/html, Size: 1721 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: sh - script: how to control the output.
  2015-11-02  7:35 sh - script: how to control the output Johann Spies
@ 2015-11-02 11:02 ` Myles English
  2015-11-02 13:00   ` Johann Spies
  0 siblings, 1 reply; 3+ messages in thread
From: Myles English @ 2015-11-02 11:02 UTC (permalink / raw)
  To: Johann Spies; +Cc: emacs-orgmode

Hello Johann,

Johann Spies writes:

> In the normal shell, I can do:
>
>  echo '\d wos.wos_papers_by_subject_mv' | psql -h localhost -p 63334
> book_citation | grep '[+|]'
>
> and get the output:
>
>   Column  |  Type   | Modifiers
> ----------+---------+-----------
>  id       | integer |
>  subject  | citext  |
>  articles | bigint  |
>
> When I try this in org-mode:
>
>
> #+BEGIN_SRC sh
>
> echo '\d wos.wos_papers_by_subject_mv' | psql -h localhost -p 63334
> book_citation | grep '[+|]'
>
>
> #+END_SRC
>
> #+results:
> | Column                           |   |   | Type    |   |   | Modifiers |
> | ----------+---------+----------- |   |   |         |   |   |           |
> | id                               |   |   | integer |   |   |           |
> | subject                          |   |   | citext  |   |   |           |
> | articles                         |   |   | bigint  |   |   |           |
>
> What should I do to get the following in org-mode as a result:

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

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

Myles

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: sh - script: how to control the output.
  2015-11-02 11:02 ` Myles English
@ 2015-11-02 13:00   ` Johann Spies
  0 siblings, 0 replies; 3+ messages in thread
From: Johann Spies @ 2015-11-02 13:00 UTC (permalink / raw)
  Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 998 bytes --]

>
> 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)

[-- Attachment #2: Type: text/html, Size: 1789 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-11-02 13:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-02  7:35 sh - script: how to control the output Johann Spies
2015-11-02 11:02 ` Myles English
2015-11-02 13:00   ` Johann Spies

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).