From: Marcel Holtmann Date: Sun, 08 May 2005 21:43:20 GMT Subject: Re: [PATCH Cogito] Make use of external editor work like CVS Message-ID: <1115588600.8949.77.camel@pegasus> In-Reply-To: <20050508200334.GG9495@pasky.ji.cz> Hi Petr, > #/bin/sh > > leading=1 > emptylines=0 > while read line; do > if ! [ "$line" ]; then > [ "$leading" ] && continue > emptylines=$(($emptylines + 1)) > else > leading=0 > while [ $emptylines -gt 0 ]; do > echo "" > emptylines=$(($emptylines - 1)) > done > echo $line > fi > done > > or something? (Based on someone else's script since I was too lazy. ;-) @@ -134,7 +134,7 @@ else cat >>$LOGMSG2 fi -grep -v ^CG: $LOGMSG2 >$LOGMSG +grep -v ^CG: $LOGMSG2 | sed '/./,${/./b;:a;$d;N;/\n$/ba;b;};d' >$LOGMSG rm $LOGMSG2 If you don't wanna squeeze then you can do it with a one-line in sed. Regards Marcel