grep all lines from start of file to line containing a string -


if have input file containing

statementes asda rertte   nothing here  

i want grep / extract (without using awk) every line starting till string "something". how can this? grep -b not work since needs exact number of lines.

desired output:

statementes asda rertte   

it's not robust, sure -b works... make -b count huge:

grep -b `wc -l <filename>` -e 'something' <filename> 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -