Very nice indeed, but I think a lot of the appeal with grep/sed/awk/wc/etc. is a. they are (somewhat, with irritating differences in some cases) cross-platform and available in every unix-y environment and b. people are simply very used to them, not to mention that there are going to be circumstances where a single interpreter reading a command is not going to be as succinct/powerful/flexible as a series of piped commands. As an alternative to perl -pe it is very interesting indeed.
a few years ago, i proposed a -x switch to ruby that would run a "puts $_.instance_eval { ... }" over each line of ARGF, but matz didn't care for it. wouldn't have done as much as pru does, but it would have had the advantage of being available by default with just a standard ruby install.
I think the consensus is, a neat project and perhaps will be adopted by some but not a replacement for the tools that have been crafted and tuned over years.
Many people (including Matz) discourage Ruby's Perlisms (or Perlish roots?), but at least for now, they're still there. (I say at least for now because Matz has said that they may go away at some point.)
Check man ruby and you'll see familiar (if you're used to Perl one-liners) command-line switches: -p, -l, -n, -F, -a, -i and so on.
Funny, just yesterday I was wondering what a shell would look like if it was an interpreter for a modern language. The important thing about the commands is the composition, not the language they are embedded in.
I think to make something as instantly usable as the the shell is quite hard, but to make an environment that is suitable for harder tasks that just get messy in the shell in a better language, but which still inherits a shell like way of doing things could be an interesting project.
There isn't much of a point to this because it doesn't change the fundamental type of data that is being piped around. You're still dealing with strings or lists of strings. The advantage of something like PowerShell, an OS built on Common Lisp, or SmallTalk is that objects can be passed around rather than just strings.
# --- print second column
ls -al | awk '{print $2}'
ls -al | pru 'split(" ")[1]'
ls -al | scc -n 'F(1)'
# --- count and average of all integers on second position
ls -al | awk '{ s += $2; } END {print "average" ,int(s/NR);print "count ",int(NR)}'
ls -al | pru 'split(" ")[1]' '"average #{mean(&:to_i)}\ncount #{size}"'
ls -al | scc 'int c=0; WRL c+=F(1); FMT("average %s\ncount %s") %(c/NR) %NR'
# --- count lines
ls -al | wc -l
ls -al | pru -r 'size'
ls -al | scc 'WRL;NR+1'
# -- replace a 5 with five
ls -al | sed 's/5/five/'
ls -al | pru 'gsub(/5/,"five")'
ls -al | scc -n 'RR(line,R("5"),"five")'
# every second line
ls -al | pru 'i % 2 == 0'
ls -al | scc -n 'NR % 2 ? line : ""'
# sum up df's used-space column
df | awk '{n+=$3;}; END{print n}'
df | pru ?????
df | scc 'int n=0; WRL n+=F(2); n'