From: erik quanstrom <quanstro@coraid.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Sam scripting
Date: Thu, 23 Nov 2006 08:13:25 -0500 [thread overview]
Message-ID: <7cf3d9b282bcf24804e48d407f86b378@coraid.com> (raw)
In-Reply-To: <BOEEJODLKDEGKJEFCFEOAEOPGAAA.koray.erkan@yahoo.com>
[-- Attachment #1: Type: text/plain, Size: 489 bytes --]
sure, you can use sam for scripting. one can suppress
starting samterm with the -d option. though this is more
like using ed in a script than sed.
i attached a unix script that i use to find people in
address files with records containing a '^NAME ' field,
delimited by newlines. it's written for byron's rc.
there's also an "ssam" out there analogous to sed.
i believe this is the url:
http://www.freshports.org/editors/ssam/
though i haven't checked it myself.
- erik
[-- Attachment #2: tel.sam --]
[-- Type: text/plain, Size: 482 bytes --]
#!/usr/local/bin/rc
# bugs -- case sensitive matching
nl = '
'
bookdir = $home/doc/address
book = ()
if (~ $1 -b){
shift
if (~ $1 /* ./ ../)
book = $1
else
book = $bookdir/$1
shift
} else {
for (i in $bookdir/*)
if (test -f $i)
book = ($book $i)
}
if (~ $#* 0)
exit 0
args = $1
shift
for (i)
args = $args'|'$i
echo 'X:.: , x/^\n/+/(.+\n)+/ g/^NAME.*('^$args^')/ p' | \
sam -d $book >[2] /dev/null | \
sed '2,$ s/^NAME/\'$nl'&/g'
next prev parent reply other threads:[~2006-11-23 13:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-23 7:17 Koray Erkan
2006-11-23 13:13 ` erik quanstrom [this message]
2006-11-23 13:36 ` Koray Erkan
2006-11-25 20:17 ` LiteStar numnums
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=7cf3d9b282bcf24804e48d407f86b378@coraid.com \
--to=quanstro@coraid.com \
--cc=9fans@cse.psu.edu \
/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.
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).