bash - How to grep -o without the -o -


i've got busybox v1.01 providing commands. hence, -o not included in grep. how can grep -o behavior without ... -o?

if have sed can use simple regex. (see linuxquestions.org)

sed -n 's/.*\(pattern\).*/\1/p' file 

so find text stackoverflow in file file.txt you'd write

sed -n 's/.*\(stackoverflow\).*/\1/p' file.txt 

remember pattern in sed command regular expression. if pattern contains meta characters of regular expression, need escaped.


Comments

Popular posts from this blog

JQuery Autocomplete without using label, value, id -

c++ - Accessing inactive union member and undefined behavior? -

JAVA - what is the difference between void and boolean methods? -