grep/search for multiple lines in a file.

Posted by GSto on Server Fault See other posts from Server Fault or by GSto
Published on 2010-04-26T20:13:24Z Indexed on 2010/04/26 20:24 UTC
Read the original article Hit count: 172

Filed under:
|

Let's say I have a file with a long nested array, that's formatted like this:

array(
   'key1' => array(
       'val1' => 'val',
       'val2' => 'val',
       'val3' => 'val',
   ),
   'key2' => array(
       'val1' => 'val',
       'val2' => 'val',
       'val3' => 'val',
   ),
   //etc...
);

what I would like to do is have a way to grep/search a file, and by knowing key 1, get all the lines (the sub-array) it contains. is this possible?

© Server Fault or respective owner

Related posts about grep

Related posts about full-text-search