Annihilannic,
may ask a similar question:
I read your solution above using awk, and I wander if you could adapt it to my need, which differs as following:
- need to process all files with filenames like "filename*" in the current directory
- need to extract line containing pattern, plus following 5 lines
in grep terms: grep "pattern containing spaces" filename*
but my grep does not apprear to have options for extracting the context of the matching line.
The background to this is:
I need to produce a list of programs (files) that are able to modify a given table(indicated by the search pattern). The particular language defines access to table on several subsequent lines of code. I would need grep to search on "pattern", and extract the record containg the pattern, followed by say the next 5 records.
then I can visually scan the output and determine which programs will modify the table, given that words like 'write', 'rewrite' 'delete' etc will be present.
Cheers