0
ここでは、grepコマンドを実践しています。次のgrep条件では明確ではありませんか?Grep条件一致はどのように機能しますか?
a_file:
boot
record
boots
process
broken
commands
私は、以下のコマンドを試してみました: -
1. grep -A0 "boo" a_file
result:
boot
--
boots
2.grep -A1 "boo" a_file
result:
boot
record
boots
process
3.grep -A2 "boo" a_file
result:
boot
record
boots
process
broken
4.grep -A3 "boo" a_file
result:
boot
record
boots
process
broken
commands
Note:I had studied this grep command from terminal man grep.
マイクエリ:
1.What is the purpose of switch -A?
2.How the context lines are ordered for every numeric values (i.e 1,2,3)?
2番目の質問は何を理解しようとしていますか? 'grep -A'はどのようにその仕事を実装していますか? – CWLiu
Aは一致した文脈を示します。私がA2を与えると、それは検索文字列(つまりブー)を探します。A2のために一致する行の後、一致する文字列の次の2行を出力します。 @CWLiu – PathFinder
はい、あなたの理解は基本的に正しいです、そして、あなたの第二の質問は何ですか、精巧にしてください。それはあなたのより正確な答えを提供するためにここに人を助けるだろう。 – CWLiu