#!/usr/bin/env bash FILE="$1" FILTER=("Budget" "Mission" "Abschuss" "Respawn" "Punkte") pat=$(echo ${FILTER[@]}|tr " " "|") while IFS= read -r line; do if [[ $line =~ [^[:space:]] ]]; then RES="$(grep -Ew "$pat" <<< "$line")" if [[ ${RES} =~ [^[:space:]] ]]; then echo ${RES} echo "" fi fi done < <(cat ${FILE} ) # Add OPT Scoreboard while IFS= read -r line; do if [[ $line =~ [^[:space:]] ]]; then echo "$line" echo "" fi done < <(grep -A 200 Scoreboard ${FILE} )