On Thursday 04 of April 2013 10:19:23 Mark van Atten wrote: > On Friday, 29 March 2013 01:38:06 UTC+1, Bence Fábián wrote: > > I did a quick writeup on little Edit scripts
(p9p specific) attached is my dirty hack for automagic grepping of $% file or recursively %s dir or pipe. a funky goodie: automatically supplies `.' (dot) between arguments, so for example: $ G some token here becomes `grep some.token.here' -- dexen deVries [[[↓][→]]] ``we, the humanity'' is the greatest experiment we, the humanity, ever undertook.
#!/usr/bin/env rc . 9.rc s=() arg=() fn addS { if (~ $#s 0) s=$1 if not s=$s.$1 } while (! ~ $#* 0) { if (~ $1 -*) arg=($arg $1) if not addS $1 shift } if (u test -p /dev/stdin) { grep -n $arg $s exit } if (test -f $%) grep -n $arg $s /dev/null `{basename $%} if not find . -type f | grep -v '[.]/share/doc/doxygen/|/[.]git/|/[.]svn/|[.](mo|pot)$' | xargs grep -n $arg $s /dev/null