I want to grep a file with a word, say \"AAA\", and it ends with whitespace or newlines. I know how to write this seperately, as follows, but having problems in combining th
You can use the -e
option of grep to select many patterns:
grep -e "AAA$" -e "AAA[[:space:]]"
From the grep man:
-e PATTERN, --regexp=PATTERN
Use PATTERN as the pattern. This can be used to specify
multiple search patterns, or to protect a pattern beginning with
a hyphen (-). (-e is specified by POSIX.)