Three new functions: pass, dropw, peek
This commit is contained in:
parent
ffff49bd0e
commit
03418caa85
1 changed files with 20 additions and 0 deletions
20
src/fun.sh
20
src/fun.sh
|
@ -193,6 +193,26 @@ filter() {
|
|||
done
|
||||
}
|
||||
|
||||
pass() {
|
||||
echo > /dev/null
|
||||
}
|
||||
|
||||
dropw() {
|
||||
local x
|
||||
while read x && $(echo "$x" | "$@"); do
|
||||
pass
|
||||
done
|
||||
[[ ! -z $x ]] && { echo $x; cat -; }
|
||||
}
|
||||
|
||||
peek() {
|
||||
local x
|
||||
while read x; do
|
||||
([ $# -eq 0 ] && 1>&2 echo $x || 1>&2 "$@" < <(echo $x))
|
||||
echo $x
|
||||
done
|
||||
}
|
||||
|
||||
stripl() {
|
||||
local arg=$1
|
||||
cat - | map lambda l . 'ret ${l##'$arg'}'
|
||||
|
|
Loading…
Reference in a new issue