1 2 3 4 5 6 7 8 9 10 11 12
#! /bin/bash re="" while IFS= read -r line; do IFS="#" read -ra filter <<< "$line" if [ -n "$filter" ]; then [ -n "$re" ] && re+="|" re+=$(echo "$filter" | sed 's/[[:space:]]\+$//') fi done < "filters.txt" cat - | grep -viP "($re)"