#!/usr/bin/env bash
fruits=$'Apple\nbanana\nAPRICOT\ncherry'
# -i: ignore case
printf '%s\n' "$fruits" | grep -i 'ap'
# -v: invert, keep lines WITHOUT the pattern
printf '%s\n' "$fruits" | grep -v 'a'
# -c: count matching lines instead of printing them
printf '%s\n' "$fruits" | grep -ic 'ap'
case-insensitive, invert, and count