You suspect a configuration file for the package nginx was modified manually. Which command
will verify this without reinstalling or removing the package?
A.B.C.D.
A published solution is not available for this question yet.
A file numbers.txt contains several lines of numeric strings. You want to find lines where any digit
is repeated exactly twice consecutively (like "1123", "4456"). Which command works correctly?
A.B.C.D.
A published solution is not available for this question yet.
Matching Control
-e PATTERNS, --regexp=PATTERNS
Use PATTERNS as the patterns. If this option is used
multiple times or is combined with the -f (--file) option,
search for all patterns given. This option can be used to
protect a pattern beginning with “-”.
-f FILE, --file=FILE
Obtain patterns from FILE, one per line. If this option is
used multiple times or is combined with the -e (--regexp)
option, search for all patterns given. The empty file
contains zero patterns, and therefore matches nothing. If
FILE is - , read patterns from standard input.
-i, --ignore-case
Ignore case distinctions in patterns and input data, so
that characters that differ only in case match each other.
--no-ignore-case
Do not ignore case distinctions in patterns and input data.
This is the default. This option is useful for passing to
shell scripts that already use -i, to cancel its effects
because the two options override each other.
-v, --invert-match
Invert the sense of matching, to select non-matching lines.
-w, --word-regexp
Select only those lines containing matches that form whole
words. The test is that the matching substring must either
be at the beginning of the line, or preceded by a non-word
constituent character. Similarly, it must be either at the
end of the line or followed by a non-word constituent
character. Word-constituent characters are letters,
digits, and the underscore. This option has no effect if
-x is also specified.
-x, --line-regexp
Select only those matches that exactly match the whole
line. For a regular expression pattern, this is like
parenthesizing the pattern and then surrounding it with *
and $.
General Output Control
-e, --count
Suppress normal output; instead print a count of matching
lines for each input file. With the -v, --invert-match
option (see above), count non-matching lines.
--color[=WHEN] , --colour[=WHEN]
Surround the matched (non-empty) strings, matching lines,
context lines, file names, line numbers, byte offsets, and
separators (for fields and groups of context lines) with
escape sequences to display them in color on the terminal.
The colors are defined by the environment variable
GREP COLORS. WHEN is never, always, or auto.
-L, --files-without-match
Suppress normal output; instead print the name of each
input file from which no output would normally have been
printed.
-1, --files-with-matches
Suppress normal output; instead print the name of each
input file from which output would normally have been
printed. Scanning each input file stops upon first match.
Which of the following commands will print only the name of all .txt files that do not contain the
word "error"? Assume the current directory does not have any subdirectories. Assume the
filenames are alphanumeric.
A.
grep -L "error" *.txt
B.
grep -v "error" *.txt
C.
grep -L "error" -- *.txt
D.
find . -name "*.txt" | xargs grep -L "error"
A published solution is not available for this question yet.