Three new functions: pass, dropw, peek

This commit is contained in:
Sławomir Śledź 2018-03-18 12:01:29 +01:00
parent ffff49bd0e
commit 03418caa85

View file

@ -193,6 +193,26 @@ filter() {
done 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() { stripl() {
local arg=$1 local arg=$1
cat - | map lambda l . 'ret ${l##'$arg'}' cat - | map lambda l . 'ret ${l##'$arg'}'