Posted by: Saajha June 6, 2007
SHELL SCRIPT HELP...
Login in to Rate this Post:     0       ?        
A quick question to Shell scripting enthusiasts (might be too trivial for the pros) Name of the file: "filename.txt" If I am to generate a list of lines that include the string "I am the KEY"; I'll run the following: cat filename.txt | grep "I am the KEY: List Me" | cut -c01-30 ... to get upto the 30th character. Now, if I want to see the line above it, the line below it, and the line even below it ( that optionally exists), which could potentially extend longer than one line-- as in the following scenario: "I want this listed" "I am the KEY: List Me" "I want this listed" "If I exist, list me too; BUT make sure you list all of me even if I extend beyond one line" How would that be accomplished? (Note: it's a windows' notepad file running on cygwin) Anyone? ~@~
Read Full Discussion Thread for this article