Re: [O] sh - script: how to control the output.

2015-11-02 Thread Johann Spies
>
> 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)


Re: [O] sh - script: how to control the output.

2015-11-02 Thread Myles English
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



[O] sh - script: how to control the output.

2015-11-01 Thread Johann Spies
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)