Hello,
I am trying to grep search a pattern and a line before it.
cat input
>record1
hello1hello2hellonhello3
>record2
helloohello1hello2hello3
When I use, grep with -o option and either of -A/B/C options, I still can't see lines before or after the pattern. But the exact pattern is being printed fine though. Any pointers are appreciated.
Expected output is
cat input | grep -o "hello[a-z]hello"
>record1
hellonhello
>record2
helloohello
But current output is
cat input | grep -o -B 1 "hello[a-z]hello"
hellonhello
helloohello
Thanks in advance.