all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Marcin Borkowski <mbork@mbork.pl>
To: Jean Louis <bugs@gnu.support>
Cc: GNU Emacs Help <help-gnu-emacs@gnu.org>
Subject: Re: How to run shell command with stream input, to get string output
Date: Mon, 01 Jul 2019 11:10:02 +0200	[thread overview]
Message-ID: <874l46w26t.fsf@mbork.pl> (raw)
In-Reply-To: <20190701081716.GA11749@protected.rcdrun.com>


On 2019-07-01, at 10:17, Jean Louis <bugs@gnu.support> wrote:

> * Marcin Borkowski <mbork@mbork.pl> [2019-07-01 09:22]:
>>
>> On 2019-07-01, at 00:32, Jean Louis <bugs@gnu.support> wrote:
>>
>> > Hello,
>> >
>> > I would like to know how to make in Emacs Lisp the
>> > equivalent function to what I have here below in
>> > Common Lisp.
>> >
>> > I wish to feed a string as stream to a command and
>> > to get the string output.
>>
>> How about `shell-command-to-string'?
>
> That one runs only shell command, without the
> input.
>
> I am looking to something equivalent to shell
>
> cat | markdown
> Hello
> =====
>
> ## Hello
> CTRL-D here
> <h1>Hello</h1>
>
> <h2>Hello</h2>
>
> I have to process thousands of files, I would not
> like writing to hard disk the feed data for
> processing to spare the hard disk.

I'm not sure I get it.

If you have your data in _files_, why don't you

(shell-command-to-string "cat <filename> | ...")

?

Even if you only have it as string within Emacs, you could probably try
(format "echo '%s'" ...), though this might involve escaping problems.

> As I cannot find solution yet in emacs lisp how to
> feed some string as input to the shell command, I
> am using now the virtual memory in /run/user/$UID
> as this way the hard disk is spared of writing
> files.

> [...]

> I have solved my problem. But if somebody knows
> how to feed the string to command as its input,
> without writing to file system, let me know.

Frankly, I'd also like to learn how to solve this.  The above
suggestions are just my 2cents, which probably do not answer your
question exactly, but might inspire someone to get a proper solution...

Best,

--
Marcin Borkowski
http://mbork.pl



  parent reply	other threads:[~2019-07-01  9:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-30 22:32 How to run shell command with stream input, to get string output Jean Louis
2019-07-01  7:18 ` Marcin Borkowski
2019-07-01  8:17   ` Jean Louis
2019-07-01  8:38     ` tomas
2019-07-01  9:06       ` Jean Louis
2019-07-01  9:38         ` Robert Pluim
2019-07-01  9:43           ` Jean Louis
2019-07-01 11:12             ` Noam Postavsky
2019-07-01 12:15               ` Jean Louis
2019-07-01  9:10     ` Marcin Borkowski [this message]
2019-07-01  9:24       ` Jean Louis
2019-07-04 19:16         ` Marcin Borkowski
2019-07-04 20:33           ` Jean Louis
2019-07-04 20:38           ` Jean Louis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874l46w26t.fsf@mbork.pl \
    --to=mbork@mbork.pl \
    --cc=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.