I'm trying to create a bash script that will grep lines from a file using egrep. I've created the regex that should group the information I want, the issue is trying to get the output. I've been testing it with the following command but nothing is printed when ran. How do I print the multiple lines between the -{80} and Disconnected?
egrep -E "^-{80}$\r?\n?([:ascii:]*)Disconnected from Server" testing.txt
File: testing.txt
Connected to the server: name here
Some header text.
More text to go though...
--------------------------------------------------------------------------------
The information that I want, would be in here;
Including this line as well #$
and this one.
Disconnected from Server...
Best Answer
You might be better off using a tool like awk.
See: http://nixtip.wordpress.com/2010/10/12/print-lines-between-two-patterns-the-awk-way/