Search the file /etc/passwd and print the first three fields of each line, then search for any line that ends with any number of whitespace characters and print the line and the two lines following it.
grep -A2 "^.*\s*$" <(cut -f1-3 /etc/passwd)