From: Evgenii Terechkov <evg-krsk@yandex.ru>
To: smoke-room@lists.altlinux.org
Subject: Re: [room] emacs shell command = grep ?
Date: Tue, 10 Feb 2009 19:08:45 +0700
Message-ID: <20090210120845.GA21531@evg.krastel.ru> (raw)
In-Reply-To: <69c7dc8b0902092206y7dc2ddcfo4b94a8c897d1776d@mail.gmail.com>
Michael Bykov пишет:
> Евгений,
> попытаюсь еще раз.
> Есть последовательность команд, последняя - grep.
> Нужно ее выполнить, причем параметр - то слово, которое высвеченно.
> Например, высвеченно 'word'. Нужно сделать ls | grep word.
> В руководстве сказано, что stdin передается в command по-умолчанию.
> Да, передается. Например в cat или в gpg. Почему не передается в grep?
Читайте внимательно: "stdin". Это не command line
arguments.
> Проще всего - высветите любое слово и сделайте
> M-| ls | grep <RET>.
> вы увидите ошибку.
Никакой ошибки - читайте внимательно документацию.
> Как записать цепочку ls | grep чтобы туда попало значение word?
> Как написать такую цепочку команд?
Надо писать код, из коробки этого я не вижу. Например, вот такой:
(defun shell-command-and-grep-by (command start end)
(interactive "sCommand:\nr")
(shell-command (format "%s | grep -e %s" command
(buffer-substring-no-properties start end))))
Далее поправьте по вкусу.
P.S.: с таки лучше в xmpp://emacs@conference.jabber.ru
--
С уважением, Терешков
Евгений.
next prev parent reply other threads:[~2009-02-10 12:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-09 16:40 Michael Bykov
2009-02-10 12:08 ` Evgenii Terechkov [this message]
2009-02-24 11:29 ` Alexey Voinov
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=20090210120845.GA21531@evg.krastel.ru \
--to=evg-krsk@yandex.ru \
--cc=smoke-room@lists.altlinux.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
Культурный офтопик
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/smoke-room/0 smoke-room/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 smoke-room smoke-room/ http://lore.altlinux.org/smoke-room \
smoke-room@lists.altlinux.org smoke-room@lists.altlinux.ru smoke-room@lists.altlinux.com smoke-room@altlinux.ru smoke-room@altlinux.org smoke-room@altlinux.com
public-inbox-index smoke-room
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.smoke-room
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git