[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] How to handle an inline multiline noweb reference
From: |
Marcin Borkowski |
Subject: |
[O] How to handle an inline multiline noweb reference |
Date: |
Tue, 27 Nov 2018 10:45:38 +0100 |
User-agent: |
mu4e 1.1.0; emacs 27.0.50 |
Hi folks,
I have a multiline source block (a complex sql query). I'd like it to
be inserted into another (shell) source block, so that I can run psql on
a remote server (via ssh) and execute this query (I cannot access the
database from my machine).
I came up with this:
--8<---------------cut here---------------start------------->8---
#+name: sql_join
#+begin_src sql
SELECT ... -- complicated, multiline query;
#+end_src
#+name: sql_oneline
#+begin_src elisp :noweb yes
(replace-regexp-in-string "\n" " " "
<<sql_join>>" t t)
#+end_src
#+begin_src sh :noweb yes :results output verbatim
ssh address@hidden "psql connector -c '<<sql_oneline()>>'"
#+end_src
--8<---------------cut here---------------end--------------->8---
but it's fairly complicated. Any better ideas?
TIA,
--
Marcin Borkowski
http://mbork.pl
- [O] How to handle an inline multiline noweb reference,
Marcin Borkowski <=
- Re: [O] How to handle an inline multiline noweb reference, Grant Rettke, 2018/11/27
- Re: [O] How to handle an inline multiline noweb reference, Samuel Wales, 2018/11/27
- Re: [O] How to handle an inline multiline noweb reference, Eric S Fraga, 2018/11/28
- Re: [O] How to handle an inline multiline noweb reference, Grant Rettke, 2018/11/28
- Re: [O] How to handle an inline multiline noweb reference, Samuel Wales, 2018/11/28
- Re: [O] How to handle an inline multiline noweb reference, Eric S Fraga, 2018/11/29
- Re: [O] How to handle an inline multiline noweb reference, Samuel Wales, 2018/11/29
- Re: [O] How to handle an inline multiline noweb reference, Samuel Wales, 2018/11/29
- Re: [O] How to handle an inline multiline noweb reference, Eric S Fraga, 2018/11/30
- Re: [O] How to handle an inline multiline noweb reference, Eric S Fraga, 2018/11/30