Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 06 Sep 2009 20:11:48 +0100
From:      Mark Willson <cdr.nil@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: is there a way of usinf greo to find 3 or 4 blank lines?
Message-ID:  <h811h5$p11$1@ger.gmane.org>
In-Reply-To: <20090906003651.GA7388@thought.org>
References:  <20090906003651.GA7388@thought.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Gary Kline wrote:
> in my manuscript, i have many places where i'ved used several
> newlines to indicate a jump in time, or topic, or mood, or
> <<whatever>>.  i have lost these vertical spacing in all but my
> original draft.  can i use grep somehow to find these extra newlines?
> 
> 
> if not grep, then sed, ed, or what?!
> 
> tia,
> 
> gary
> 
> 
> 
Gary,

If I understand your question correctly (by no means certain), the
following may help.  This is an awk script, which will print out the
lines in the source file at which it finds more than three consecutive
empty lines.

BEGIN {
     ncnt = 0
}
/^ *$/ {
	ncnt++;
         if (ncnt > 3)
		{print "Emphasis at: " NR;
		 ncnt = 0;}
	 next;
	}
        {ncnt = 0;}

You can invoke this (assuming the awk source in is a file called
"em.awk" and your original manuscript is in a file called "manuscript") by:

$ awk -f em.awk manuscript

-mark




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?h811h5$p11$1>