Gnus development mailing list
 help / color / mirror / Atom feed
* pipe filter output to file?
@ 1998-10-08 18:07 Bud Rogers
  1998-10-08 20:25 ` Wes Hardaker
  1998-10-09  8:52 ` Kai Grossjohann
  0 siblings, 2 replies; 11+ messages in thread
From: Bud Rogers @ 1998-10-08 18:07 UTC (permalink / raw)


I would like to grep a specific line out of a mail or news message and
append it to a file.  The messages are essentially boilerplate containing a 
single action line that I need to collect and feed to a shell script.

I've tried Washing->Unix pipe and Output->pipe through a filter, but I
can't seem to get either to do what I want.  Has anybody done this?  Could
I get a look at your code?

Ideally I would like to use nnml-split or -split-fancy to automate the
process.  Any suggestions would be welcome.


-- 

Bud Rogers <budr@sirinet.net>	http://www.sirinet.net/~budr/zamm.html
  formerly <budr@tanet.net>


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

* Re: pipe filter output to file?
  1998-10-08 18:07 pipe filter output to file? Bud Rogers
@ 1998-10-08 20:25 ` Wes Hardaker
  1998-10-09  4:13   ` Bud Rogers
  1998-10-09  8:52 ` Kai Grossjohann
  1 sibling, 1 reply; 11+ messages in thread
From: Wes Hardaker @ 1998-10-08 20:25 UTC (permalink / raw)
  Cc: ding

>>>>> On 08 Oct 1998 13:07:29 -0500, Bud Rogers <budr@sirinet.net> said:

Bud> I've tried Washing->Unix pipe and Output->pipe through a filter,
Bud> but I can't seem to get either to do what I want.  Has anybody
Bud> done this?  Could I get a look at your code?

Doesn't something like
  M-| grep stuff >> file

work?

-- 
"Ninjas aren't dangerous.  They're more afraid of you than you are of them."


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

* Re: pipe filter output to file?
  1998-10-08 20:25 ` Wes Hardaker
@ 1998-10-09  4:13   ` Bud Rogers
  1998-10-09 16:09     ` Wes Hardaker
  0 siblings, 1 reply; 11+ messages in thread
From: Bud Rogers @ 1998-10-09  4:13 UTC (permalink / raw)


Wes Hardaker <wjhardaker@ucdavis.edu> writes:

> >>>>> On 08 Oct 1998 13:07:29 -0500, Bud Rogers <budr@sirinet.net> said:
> 
> Bud> I've tried Washing->Unix pipe and Output->pipe through a filter,
> Bud> but I can't seem to get either to do what I want.  Has anybody
> Bud> done this?  Could I get a look at your code?
> 
> Doesn't something like
>   M-| grep stuff >> file
> 
> work?

Hmm.  I get either 'There is no region now' or "Shell command completed
with no output' depending on where point is.  

If I use 'Output->pipe through a filter' to a one-liner containing my grep
statement, I get the message body cleaned of everything except the line I'm
after, but that's not what I need.  What I need is to send that line out to
a file.  I'm getting a couple dozen of these emails a day and I need to
collect those lines so I can feed them into a shell script about once a
day.

Aarrgh.  I've learned just enough about [X]emacs and gnus and lisp to know
the power is there if I can just figure it out...

-- 

Bud Rogers <budr@sirinet.net>	http://www.sirinet.net/~budr/zamm.html
  formerly <budr@tanet.net>


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

* Re: pipe filter output to file?
  1998-10-08 18:07 pipe filter output to file? Bud Rogers
  1998-10-08 20:25 ` Wes Hardaker
@ 1998-10-09  8:52 ` Kai Grossjohann
  1998-10-09 16:39   ` Bud Rogers
  1 sibling, 1 reply; 11+ messages in thread
From: Kai Grossjohann @ 1998-10-09  8:52 UTC (permalink / raw)
  Cc: ding

>>>>> Bud Rogers <budr@sirinet.net> writes:

  > I would like to grep a specific line out of a mail or news message
  > and append it to a file.  The messages are essentially boilerplate
  > containing a single action line that I need to collect and feed to
  > a shell script.

| grep foo >> /tmp/bar RET

The above, when typed from the summary buffer, should append all lines
matching foo to the file /tmp/bar.

kai
-- 
OOP: object oriented programming;  OOPS: object oriented mistakes


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

* Re: pipe filter output to file?
  1998-10-09  4:13   ` Bud Rogers
@ 1998-10-09 16:09     ` Wes Hardaker
  0 siblings, 0 replies; 11+ messages in thread
From: Wes Hardaker @ 1998-10-09 16:09 UTC (permalink / raw)
  Cc: ding

>>>>> On 08 Oct 1998 23:13:46 -0500, Bud Rogers <budr@sirinet.net> said:

>> M-| grep stuff >> file

Bud> Hmm.  I get either 'There is no region now' or "Shell command completed
Bud> with no output' depending on where point is.  

Opps.  It should be a simple "|", not a meta-|

Bud> If I use 'Output->pipe through a filter' to a one-liner
Bud> containing my grep statement, I get the message body cleaned of
Bud> everything except the line I'm after, but that's not what I need.
Bud> What I need is to send that line out to a file.

Right, thats what the ">> file" part  should do.


-- 
"Ninjas aren't dangerous.  They're more afraid of you than you are of them."


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

* Re: pipe filter output to file?
  1998-10-09  8:52 ` Kai Grossjohann
@ 1998-10-09 16:39   ` Bud Rogers
  1998-10-09 16:50     ` Kai Grossjohann
  0 siblings, 1 reply; 11+ messages in thread
From: Bud Rogers @ 1998-10-09 16:39 UTC (permalink / raw)


Kai Grossjohann <grossjohann@amaunet.informatik.uni-dortmund.de> writes:

> | grep foo >> /tmp/bar RET
> 
> The above, when typed from the summary buffer, should append all lines
> matching foo to the file /tmp/bar.

No joy, Kai.  I understand that vertical bar to mean M-|, yes?  I get
'There is no region now'.  If I use | without Meta, I get 'Wrong type
argument: stringp nil'.  I also tried marking all articles first, but that
didn't help either.

-- 

Bud Rogers <budr@sirinet.net>	http://www.sirinet.net/~budr/zamm.html
  formerly <budr@tanet.net>


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

* Re: pipe filter output to file?
  1998-10-09 16:39   ` Bud Rogers
@ 1998-10-09 16:50     ` Kai Grossjohann
  1998-10-11 15:09       ` Bud Rogers
  0 siblings, 1 reply; 11+ messages in thread
From: Kai Grossjohann @ 1998-10-09 16:50 UTC (permalink / raw)
  Cc: ding

>>>>> Bud Rogers <budr@sirinet.net> writes:

  > No joy, Kai.  I understand that vertical bar to mean M-|, yes?  I get
  > 'There is no region now'.  If I use | without Meta, I get 'Wrong type
  > argument: stringp nil'.  I also tried marking all articles first, but that
  > didn't help either.

I typed `|', I meant `|' :-)  What does C-h c | tell you when typed in
a Gnus summary buffer?  For me, it says it runs the command
gnus-summary-pipe-output.  If it is different for you, that might be a
problem. 

I use that command and a shell script `gnusprint' all the time for
printing articles from Gnus, so I'm *pretty* sure `|' works for me.

Just for fun, could you `emacs -q -no-site-file' then start Gnus then
see whether `|' works.  The `-q' means don't load ~/.emacs, the
`-no-site-file' means don't load site-start.el.  Omitting one of the
two arguments loads the respective file, this way you can narrow down
where the problem might be.

(For starting Gnus in `emacs -q -no-site-file' you might have to do
some setup by hand, such as setting the nntp server and stuff.  Try to
keep that to a minimum, though.)

kai
-- 
OOP: object oriented programming;  OOPS: object oriented mistakes


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

* Re: pipe filter output to file?
  1998-10-09 16:50     ` Kai Grossjohann
@ 1998-10-11 15:09       ` Bud Rogers
  1998-10-11 16:31         ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 11+ messages in thread
From: Bud Rogers @ 1998-10-11 15:09 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2366 bytes --]

Kai Grossjohann <grossjohann@amaunet.informatik.uni-dortmund.de> writes:

> What does C-h c | tell you when typed in a Gnus summary buffer?  For me,
> it says it runs the command gnus-summary-pipe-output.  If it is different
> for you, that might be a problem.

It is defined as gnus-summary-pipe-output.

> Just for fun, could you `emacs -q -no-site-file' then start Gnus then see
> whether `|' works.  The `-q' means don't load ~/.emacs, the
> `-no-site-file' means don't load site-start.el.  Omitting one of the two
> arguments loads the respective file, this way you can narrow down where
> the problem might be.

I spent some time with this.  By temporarily renaming my startup files one
by one I've narrowed it down a little more.  My .emacs seems to be OK.  If
I rename .gnus AND .xemacs-options I'm OK.  If I load either .gnus OR
.xemacs-options, I get 'Wrong type argument: stringp, nil'.  The backtraces
in either case appear to be identical except for the tmp buffer name.

I've been through both files and I don't see anything obviously wrong.  But
then, I don't really know what I'm looking for.

Backtrace with .gnus loaded follows.  I hope that's OK.

Signaling: (wrong-type-argument stringp nil)
call-process-internal("/bin/bash" "/tmp/emacsa29486" #<buffer "*Shell
Command Output*"> nil "-c" nil) apply(call-process-internal "/bin/bash"
"/tmp/emacsa29486" #<buffer "*Shell Command Output*"> nil ("-c" nil))
call-process("/bin/bash" "/tmp/emacsa29486" #<buffer "*Shell Command
Output*"> nil "-c" nil) apply(call-process "/bin/bash" "/tmp/emacsa29486"
#<buffer "*Shell Command Output*"> nil ("-c" nil)) call-process-region(1
3244 "/bin/bash" nil #<buffer "*Shell Command Output*"> nil "-c" nil)
shell-command-on-region(1 3244 nil nil) gnus-summary-save-in-pipe(default)
byte-code("\b¬„ÁÂ!‡\vqˆ\f\x1d\x0e\x06¬ƒÇª‹\x0e\x06Èa«ƒÉª‚\x0e\n\x1e\v\x0e\x06Ìa­‚\x0e\r\x1e\x0e\x0e\x0fqˆ\b\x0e\v!+‡"
[gnus-default-article-saver error "No default saver is defined"
gnus-article-buffer save-buffer gnus-save-article-buffer
gnus-prompt-before-saving default always nil file filename t num
gnus-number-of-articles-to-be-saved gnus-article-current-summary] 2)
gnus-article-save(#<buffer " *Gnus Save*"> nil 1)
gnus-summary-save-article(nil t) gnus-summary-pipe-output(nil)
call-interactively(gnus-summary-pipe-output)


--

Bud Rogers <budr@sirinet.net> http://www.sirinet.net/~budr/zamm.html
formerly <budr@tanet.net>


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

* Re: pipe filter output to file?
  1998-10-11 15:09       ` Bud Rogers
@ 1998-10-11 16:31         ` Lars Magne Ingebrigtsen
  1998-10-11 17:54           ` Bud Rogers
  0 siblings, 1 reply; 11+ messages in thread
From: Lars Magne Ingebrigtsen @ 1998-10-11 16:31 UTC (permalink / raw)


Bud Rogers <budr@sirinet.net> writes:

> Backtrace with .gnus loaded follows.  I hope that's OK.

You seem to have filled the backtrace, which makes it rather difficult
to read, but:


> shell-command-on-region(1 3244 nil nil) gnus-summary-save-in-pipe(default)

gnus-summary-save-in-pipe is called with `default' as the parameter.
Do you have gnus-prompt-before-saving set to nil?

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen


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

* Re: pipe filter output to file?
  1998-10-11 16:31         ` Lars Magne Ingebrigtsen
@ 1998-10-11 17:54           ` Bud Rogers
  1998-10-11 17:59             ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 11+ messages in thread
From: Bud Rogers @ 1998-10-11 17:54 UTC (permalink / raw)


Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> You seem to have filled the backtrace, which makes it rather difficult
> to read, but:

Oops.  Didn't intend to.  I guess when I snipped and filled Kai's comments
my ever-helpful gnus did the backtrace too.

> > shell-command-on-region(1 3244 nil nil) gnus-summary-save-in-pipe(default)
> 
> gnus-summary-save-in-pipe is called with `default' as the parameter.
> Do you have gnus-prompt-before-saving set to nil?

Yes I did, although I don't remember when or why.  Changed to t and pipe
works as advertised.  Thank you.

-- 

Bud Rogers <budr@sirinet.net>	http://www.sirinet.net/~budr/zamm.html
  formerly <budr@tanet.net>


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

* Re: pipe filter output to file?
  1998-10-11 17:54           ` Bud Rogers
@ 1998-10-11 17:59             ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 11+ messages in thread
From: Lars Magne Ingebrigtsen @ 1998-10-11 17:59 UTC (permalink / raw)


Bud Rogers <budr@sirinet.net> writes:

> > gnus-summary-save-in-pipe is called with `default' as the parameter.
> > Do you have gnus-prompt-before-saving set to nil?
> 
> Yes I did, although I don't remember when or why. 

But I think gnus-prompt-before-saving set to nil shouldn't break the
gnus-summary-save-in-pipe command.  The problem is that
gnus-summary-save-in-pipe doesn't have a default default value.
Perhaps I could just default to "cat"?  Eh.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen


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

end of thread, other threads:[~1998-10-11 17:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-10-08 18:07 pipe filter output to file? Bud Rogers
1998-10-08 20:25 ` Wes Hardaker
1998-10-09  4:13   ` Bud Rogers
1998-10-09 16:09     ` Wes Hardaker
1998-10-09  8:52 ` Kai Grossjohann
1998-10-09 16:39   ` Bud Rogers
1998-10-09 16:50     ` Kai Grossjohann
1998-10-11 15:09       ` Bud Rogers
1998-10-11 16:31         ` Lars Magne Ingebrigtsen
1998-10-11 17:54           ` Bud Rogers
1998-10-11 17:59             ` Lars Magne Ingebrigtsen

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 NNTP newsgroup(s).