RUNFOR(1): run commands for input lines matching expressions __________________________________________________ USAGE usage: runfor [-Dnuv] {expr cmd} -D: debug -n: dry run (don't run any command) -u: don't use unix out -v: verbose DESCRIPTION Runfor takes pairs of expressions and commands as arguments and reads input lines. For each input line it runs the command with the first matching expression. Expressions are written like in sre(2). The command strings given may contain back-references of the form \0, \1, ... that are replaced with the matched string or substring. If further input lines matching the expression for a given command are received while the command is running, they are discarded. EXAMPLE Receive OSX events and (1) print those that contain 'apple' and (2) for paths of the form '/u/*/...' print the second component of the path. % osev | runfor apple 'echo \0' '^/u/[^/]+/' 'echo \1' Run Lgo fmt on directories under /u/gosrc/ as they have their files changed: % osenv | runfor '^/u/gosrc/.*' 'Lgo fmt \0' SOURCE +o /zx/sys/src/clive/cmd/runfor __________________________________________________ User's manual. Section 1. Copyright © LSUB 2014-2016