|
Using grep -o in linux, it gives the list wherever the pattern appears. The file
input_file has "Hello World
Hi Hello Hello Hello
Hello
Bye
"
for eg: grep -o "Hello" input_file
Hello
Hello
Hello
Hello
Hello
sed -n -e "s/.*\(Hello\).*/\1/p" input_file
But in using sed, it prints One Hello per line, becoz of \1.
Is it any other way to print same as in linux.
TIA
|