* Re: Streaming sam.
@ 1992-12-04 17:57 Alan Watson
0 siblings, 0 replies; 4+ messages in thread
From: Alan Watson @ 1992-12-04 17:57 UTC (permalink / raw)
To: sam-fans
Scrub that. Try the following awful hack:
; cat rev
,x/\\/ i/\\/
,x/\// i/\\/
,x i/0i\//
,x s/\n/\\n\/\n/
$a/,p\n/
,|sam -d
; ifs = $nl ssam `{ cat rev } <rev >rev2
; ifs = $nl ssam `{ cat rev } <rev2 >rev3
; diff rev rev3
;
A free email message to anyone who can do better. I think I'd better
lie down.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Streaming sam.
@ 1992-12-04 19:10 Byron Rakitzis
0 siblings, 0 replies; 4+ messages in thread
From: Byron Rakitzis @ 1992-12-04 19:10 UTC (permalink / raw)
To: alan, sam-fans
I've written a very basic stream sam, more of a toy than anything else,
just to see how it would feel. I think there are some basic problems
with the command language as applied to streams that the idea doesn't
work.
I don't want to duke it out on the list; I don't have time. My source
is available to anyone who cares. It's a couple of hundred lines of
C and implements x, y, a, c, and i. I use Henry's regexp package with
hacks to make $ and ^ work on newlines, not just beginning- and end-of-
string.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Streaming sam.
@ 1992-12-04 16:44 Alan Watson
0 siblings, 0 replies; 4+ messages in thread
From: Alan Watson @ 1992-12-04 16:44 UTC (permalink / raw)
To: sam-fans
Sigh. The reverse trick doesn't work. It's been a bad month. Try:
; ssam ',x m$' <foo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Streaming sam.
@ 1992-12-04 16:40 Alan Watson
0 siblings, 0 replies; 4+ messages in thread
From: Alan Watson @ 1992-12-04 16:40 UTC (permalink / raw)
To: sam-fans
I have a recollection that a streaming version of sam a la sed is
mentioned somewhere in the sam documentation, but I cannot find this
reference now.
Was this ever implemented, and what was it's syntax and semantics?
I'm using the following (the error handling of which might be better),
but I wonder if there is a precedent to follow. This version doesn't
really stream in the sense that I am used to (meaning set up some
commands and then stream the entire file past the commands), but it is
more flexible. For example, to reverse a file one can use:
; ssam ',x m0' <foo
Alan.
; cat $home/bin/ssam
#! /usr/users/alan/bin/rc
if ( ~ $#* 0) {
echo >[1=2] Usage: ssam commands ...
exit 1
}
FIFO=/usr/tmp/ssam.$pid.rd
mkfifo $FIFO
{
echo 'r '$FIFO
while ( ! ~ $#* 0 ) {
echo $1
shift
}
echo ',p'
} | sam -d >[2=] &
cat >$FIFO
wait $apid
rm -f $FIFO
exit 0
# end-of-file
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1992-12-04 19:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1992-12-04 17:57 Streaming sam Alan Watson
-- strict thread matches above, loose matches on Subject: below --
1992-12-04 19:10 Byron Rakitzis
1992-12-04 16:44 Alan Watson
1992-12-04 16:40 Alan Watson
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).