Answer the question
In order to leave comments, you need to log in
What command can replace grep -A?
It is necessary to display the description of the --color key from man ls. The teacher said to use man ls | grep - - '- -color' . But then the description is not displayed. What can replace grep-A with?
Answer the question
In order to leave comments, you need to log in
man ls | grep -A 1 "\-\-color\[=WHEN\]"
-A 1
- after 1 line after found
'\-\-color\[\=WHEN\]'
- escape special characters
Now you can either cut off show 1 line from the end
or
man ls | grep -A 1 "\-\-color\[=WHEN\]" | tail -n1
tail - n1
man ls | grep -A 1 "\-\-color\[=WHEN\]" | grep -v =WHEN
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question