[CentOS] grep
Warren Young
warren at etr-usa.comTue Aug 28 14:23:12 UTC 2007
- Previous message: [CentOS] grep
- Next message: [CentOS] grep
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Scott McClanahan wrote: > grep out the next 5 lines after the first and only instance The scope of grep's view of the world is a single line. At any one time, it knows nothing more. If you need to deal with multiple lines, I suggest perl. Untested code: #!/usr/bin/perl while (<>) { if (m/bar/) { for ($i = 0; $i < 5 and defined($_); ++$i) { print; $_ = <>; } last; } }
- Previous message: [CentOS] grep
- Next message: [CentOS] grep
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the CentOS mailing list