You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
425 B

#!/usr/bin/env bash
# will grep for each argument passed
# Can pass each search arguments by adding an argument before in the form
# --args="-i -E" or --args "-i -E"
if [ -n "$1" ]; then
args=""
if [[ "$1" == "--args" ]]; then
args=( $2 )
shift
shift
elif [[ "$1" == "--args="* ]]; then
tmp="${1#--args=}"
args=( $tmp )
shift
fi
i="$1"
shift
cat - | grep ${args[@]} "$i" | multigrep "$@"
else
cat -
fi