#!/bin/sh - /usr/local/bin/gawk ' BEGIN { quoted_lines_limit=30 IGNORECASE=1 RS="" } NR==1 { print print "" RS="\n" next } { if (match($0, /^>/)) ++quoted_lines else { if (match($0, /^[ \t]*$/)) quoted_lines=0 else if (quoted_lines>quoted_lines_limit) ++quoted_lines } if (quoted_lines<=quoted_lines_limit) print else if (quoted_lines==quoted_lines_limit+1) print "-- automatically snipped --" } '