diff options
| -rw-r--r-- | convert.awk | 33 | ||||
| -rw-r--r-- | convert2.awk | 32 |
2 files changed, 26 insertions, 39 deletions
diff --git a/convert.awk b/convert.awk index a36801e..f06c187 100644 --- a/convert.awk +++ b/convert.awk @@ -1,31 +1,18 @@ -BEGIN { - line=0; -} - -# NR==1,/Amalie Skram\. I\./ { next } - # Footer -/^ *[0-9]* *Constance *Ring *[0-9]* *$/ { next } +/^ *[0-9]* *Constance *Ring *[0-9]* *$/ { + next +} # Mark chapters /^ *([IVX][IVX]*)\.* *$/ { - gsub(/ */, "") - gsub(/\./, "") - print "" - print "# Kapittel " $0 - print "" - next + gsub(/ */, "") + gsub(/\./, "") + print "" + print "# Kapittel " $0 + print "" + next } { -# # Format paragaph starts -# gsub(/^ */, "\n") -# -# # Remove leading space -# gsub(/^ */, "") -# -# # Remove excessive inline space -# gsub(/ */, " ") -# - print + print } diff --git a/convert2.awk b/convert2.awk index b801ef1..a4c5a24 100644 --- a/convert2.awk +++ b/convert2.awk @@ -1,24 +1,24 @@ # awk { - while (match($0, /-$/)) { - # Drop line continuation - gsub(/-$/, "") + while (match($0, /-$/)) { + # Drop line continuation + gsub(/-$/, "") - # Print the line, without newline - printf "%s", $0 + # Print the line, without newline + printf "%s", $0 - # Get the next line, skipping blank lines - do { - getline - } while($0==""); + # Get the next line, skipping blank lines + do { + getline + } while($0==""); - # Print the first word - printf "%s\n", $1 + # Print the first word + printf "%s\n", $1 - # Drop the first word, remove leading whitespace - $1="" - sub(/^[ \t]+/, "") - } + # Drop the first word, remove leading whitespace + $1="" + sub(/^[ \t]+/, "") + } - print + print } |
