# ng_domain_1="$(_egrep_o "Hostname:[a-z0-9]+.ngrok.io" <"$ng_temp_1" | _head_n 1 | cut -d':' -f2)"
grep_o() {
  # POSIX-compliant implementation of GNU `grep -o`
  # https://github.com/acmesh-official/acmetest/blob/b00e8f1875/letest.sh#L169
  { { command -p -- test "${#}" -eq 0 && command -p -- cat -- -; } || command -p -- printf -- '%s\n' "${@-}"; } |
    command -p -- sed \
      -n \
      -e 's/.*\('"${1-}"'\).*/\1/p'
}

ls −l | grep '[[:upper:]][[:digit:]]' ## any uppercase letter followed by any digit.

rm file[^7]                   ## perform a logical "not" removing file1,file2,file3 etc
                                 and saving file7

cat myfile | grep '^s.*n$'    ## lines starting with an "s" and ending with an "n"

grep -v '^$' file | grep -v '^#' ## select only lines => not blank and not comment

grep '^Linux' file1  ## display all lines from file1 where the string Linux appears at the start of the line:
grep 'x$' file1      ## display lines in file1 where the last character is an x :
grep '^[^0-9]' file1 ## display all lines from file1 beginning with any single character other than a digit:

grep -c '^$' file1   ## display number of empty lines in file1 by finding lines with nothing between the beginning and the end:

grep '^null$' file1  ## display all lines from file1 containing only the word null by itself:

grep '[Ll]inux' file1 ## display all lines from file1 containing Linux , linux , TurboLinux , and so on:

grep '[0-9][0-9][0-9]' file1 ## display all lines from file1 that contain three adjacent digits:

grep '\<[Ll]inux\>' file1 ## Display all lines from file1 that contain the whole word Linux or linux , but not LinuxOS or TurboLinux :
grep '.....' file1        ## Display all lines from file1 with five or more characters on a line (excluding the newline character):
grep '.' file1          ## Display all nonblank lines from file1 (i.e., that have at least one character):
grep '\.' file1         ## Display all lines from file1 that contain a period (normally a metacharacter) using an escape:
grep 'abcc*' file1      ## Display all lines from file1 that contain abc , abcc , abccc , and so on, but not ab :
grep '[0-9][0-9][0-9]*' file1    ## Display all lines from file1 that contain
grep '[0-9]\{2,\}' file1      ## two or more adjacent digits:
grep 'file[12]\?' file1      ## Display lines from file1 that contain file (because ? can match zero occurrences), file1 , or file2 :
grep '[0-9]\+' file1      ## Display all lines from file1 containing at least one digit:
grep '^1\{3,5\}$' file1      ## Display all lines from file1 that contain 111 , 1111 , or 11111 on a line by itself:
grep '\(abc\)\{2,\}' file    ## Display all lines of file that contain any repeated sequence of abc ( abcabc , abcabcabc , and so on):
grep '\<[0-9]\{3,5\}\>' file1       ## Display all lines from file1 that contain any three-, four-, or five-digit number:
grep -E '[Hh]appy|[Ss]ad|[Aa]ngry' file1  ## Display all lines from file1 that contain Happy , happy , Sad , sad , Angry , or angry :

grep '[A-Za-z]'      ## Match any letter:
grep '[^0-9A-Za-z]'  ## Match any symbol (not a letter or digit):
grep '[A-Z][a-z]*'   ## Match an uppercase letter, followed by zero or more lowercase letters:

grep -i                   # case insensitive
grep ^                    # begining of the line
grep $                    # end of the line
grep -E '^(b|d)'          # anything that begins with either b or d
grep -E '^[a-k]'          # anything that starts with a-k
grep -E '^([a-k]|[A-K])'
grep -E
grep -r eth /etc/*
grep -r eth[01] /etc/*
grep -E "(\.edu).*127" /etc/*
grep -E "(\.edu).*127" /etc/*
grep -E -r 127. /etc/*
grep -E -r 127.0.0.1: /etc/*

grep 'FOO\|BAR' # Find lines that contain FOO, and lines that contain BAR
grep 'FOO$'     # Find lines that end with FOO
grep '^[0-9]'   # Find lines that start with a number
grep '^FOO'     # Find lines that start with FOO
