BEGIN { line=0; } # NR==1,/Amalie Skram\. I\./ { next } # Footer /^ *[0-9]* *Constance *Ring *[0-9]* *$/ { next } # Mark chapters /^ *([IVX][IVX]*)\.* *$/ { gsub(/ */, "") gsub(/\./, "") print "" print "# Kapittel " $0 print "" next } { # # Format paragaph starts # gsub(/^ */, "\n") # # # Remove leading space # gsub(/^ */, "") # # # Remove excessive inline space # gsub(/ */, " ") # print }