A
A
alexsosilvas2020-05-17 15:59:51
linux
alexsosilvas, 2020-05-17 15:59:51

Display all lines of hello.txt that contain the word "Hi" and 5 lines below each?

Guys, I need to do a task on theory, tell me, did I formulate the request correctly?

grep -B5 "Hello" /var/log/hello.txt

or

$ grep -B5 "Hello" /var/log/hello.txt

P,S. If I'm a total noob...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pfemidi, 2020-05-17
@pfemidi

Probably not "-B 5", but "-A 5". "-B" will output lines above, not below. So
grep -A5 "Привет" /var/log/hello.txt
But it's not accurate ;-)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question