On Fri, Sep 26, 2003 at 01:03:49PM -0500, Ben Bargabus wrote: > I have a text file full of records, one record per line. I'd like to do > a keyword search similar to... > > sed -n /keyword/p > > but return not only the matching line, I also want the previous three > and the next three with it (if there are less than three in either > direction I want as many as possible). Since sed is a stream editor I > believe it only receives one line at a time so it may not be possible to > do this, would awk give me the additional capability I need? How about > sed with a little shell scripting. I know someone will suggest Perl but > I don't know it and don't really want to learn it today so let's save > that for a last resort. Any other ideas? man grep grep -3 keyword file ... -- trammell at el-swifto.com 9EC7 BC6D E688 A184 9F58 FD4C 2C12 CC14 8ABA 36F5 Twin Cities Linux Users Group (TCLUG) Minneapolis/St. Paul, Minnesota _______________________________________________ TCLUG Mailing List - Minneapolis/St. Paul, Minnesota http://www.mn-linux.org tclug-list at mn-linux.org https://mailman.real-time.com/mailman/listinfo/tclug-list