#!/usr/bin/env bash set -e helpFunction() { echo "" echo "Usage: $0 -f file_path -o output_path" echo -e "\t-f file path" echo -e "\t-o output path" exit 1 } while getopts "f:o:" opt do case "$opt" in f ) filePath="$OPTARG" ;; o ) outputPath="$OPTARG" ;; ? ) helpFunction ;; esac done # start cnt=0 while read -r line; do cnt=$(( cnt + 1 )) echo -ne "testing $cnt case... \r" if ! rg -q "('|\")$line('|\")" < /dev/null; then # not found (exit code !== 0) echo "$line" >> "$outputPath" fi done < "$filePath" echo "done. "