14 Eylül 2010

search for a text spawned to several lines of a file

omg awk is s.f.cool...



#!/usr/bin/ksh

cat source.log | awk 'BEGIN {x=0}
{
if ($0~"STARTINGMARK") {x=1}
if (x==1) {print $0}
if ($0~"ENDINGMARK") {x=0}
}' > output.log

Hiç yorum yok: