Posted by: oldmaven June 8, 2007
SHELL SCRIPT HELP...
Login in to Rate this Post:     0       ?        
. Try AWK instead ! # awk -f test.awk filename.txt test.awk /I am the KEY: List Me/{print x};{x=$0} /I am the KEY: List Me/ /I am the KEY: List Me/{getline;print} this prints one line above , one line below . i guess, you can do some loop-checking after the third statement. If you know the STOP regular expression statement, there is a better mechanism .. too , like : awk '/I want this listed/, /THE STOP LINE REGEXP;/' filename.txt
Read Full Discussion Thread for this article