ref: 2258d8a2a943e7e6e19d06240b9fcc82502f80df
author: glenda <glenda@dwp9>
date: Mon Jan 19 15:57:03 EST 2026
This is the initial commit of Dan Cross' sor
--- /dev/null
+++ b/README
@@ -1,0 +1,2 @@
+This is Dan Cross' sor, retrieved from the WaybackMahine at
+https://web.archive.org/web/20170601083931/http://plan9.bell-labs.com/sources/contrib/cross, along with a hastily prepared man page to help things along.
\ No newline at end of file
--- /dev/null
+++ b/man/sor
@@ -1,0 +1,47 @@
+.TH SOR 1
+.SH NAME
+sor \- execute rc predicates as a logical 'or.'
+.SH SYNOPSIS
+.B sor
+.B 'fragment' ['fragment']...
+.SH DESCRIPTION
+sor \- stream or \- read newline separated paths from stdin \- for each path 'eval' each of the
+arguments as a rc fragment and put the path on stdout if any pass;
+sor is a logical companion to walk, but can be used with any list of newline
+separated paths presented on stdin.
+.SH EXAMPLES
+.IP
+.EX
+% walk | sor 'test -d' 'test -x'
+.EE
+.LP
+will provide a list of directories and executable files in the current directory and below.
+.IP
+.EX
+% walk | sor 'grep foobar'
+.EE
+.LP
+will provide a list of files containing the string foobar, along with the containing line.
+.IP
+.EX
+% walk | sor 'grep -l foobar'
+.EE
+.LP
+will provide only the file list.
+.IP
+.EX
+% walk | grep '\.*\\.c$' | sor 'grep -l foobar'
+.EE
+.LP
+will list the C source files containing the string 'foobar'.
+.SH SOURCE
+To be determined if included
+.SH HISTORY
+.B sor
+was authored by Dan Cross, and retrieved from the WaybackMahine at
+https://web.archive.org/web/20170601083931/http://plan9.bell-labs.com/sources/contrib/cross
+.SH "SEE ALSO"
+.IR walk (1),
+.IR test (1),
+.IR grep (1),
+.IR rc (1).
--- /dev/null
+++ b/sor
@@ -1,0 +1,15 @@
+#!/bin/rc
+rfork e
+
+fn runtests {+ file=$1; shift
+ while (! ~ $#* 0 && ! eval $1 ''''^$file^'''')
+ shift
+ if (! ~ $#* 0)
+ echo $file
+}
+
+while (file = `{read}) {+ runtests $file $*
+}
+
--
⑨