3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Linux / Bash — 2個のキーワードの間で grep する

Last updated at Posted at 2018-08-22

  • grep の結果に対して grep を実行 (計二回)
  • -A ( After という意味 ) オプションに適当な大きな数字を渡す ( e.g 10000 )
  • -B ( Bfter という意味 ) オプションに適当な大きな数字を渡す ( e.g 10000 )
echo "V\nW\nX\nY\nZ" | grep -A 10000 W | grep -B 10000 Y
W
X
Y

Versions

  • GNU bash, version 4.4.23(1)-release (x86_64-apple-darwin17.5.0)

Links

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

3
1
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?