emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to handle an inline multiline noweb reference
@ 2018-11-27  9:45 Marcin Borkowski
  2018-11-28  2:08 ` Grant Rettke
  0 siblings, 1 reply; 14+ messages in thread
From: Marcin Borkowski @ 2018-11-27  9:45 UTC (permalink / raw)
  To: Org-Mode mailing list

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 user@host "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

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

end of thread, other threads:[~2018-12-02  4:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-27  9:45 How to handle an inline multiline noweb reference Marcin Borkowski
2018-11-28  2:08 ` Grant Rettke
2018-11-28  2:33   ` Samuel Wales
2018-11-28  7:08     ` Eric S Fraga
2018-11-28 17:33       ` Grant Rettke
2018-11-28 22:35       ` Samuel Wales
2018-11-29  6:24         ` Eric S Fraga
2018-11-29 22:16           ` Samuel Wales
2018-11-29 22:18             ` Samuel Wales
2018-11-30  6:46               ` Eric S Fraga
2018-11-30  6:44             ` Eric S Fraga
2018-11-30 15:20       ` Marcin Borkowski
2018-11-30 17:23   ` Marcin Borkowski
2018-12-02  3:59     ` Grant Rettke

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