diff options
| author | Trygve Laugstøl <trygvis@inamo.no> | 2025-07-10 19:25:30 +0200 |
|---|---|---|
| committer | Trygve Laugstøl <trygvis@inamo.no> | 2025-07-10 19:26:38 +0200 |
| commit | 6a37ba289436cc09270cf63810888acb7df53002 (patch) | |
| tree | 5eb802acf511b6c8941b202d7d7c9d9f4b037b39 /stage-4.awk | |
| parent | b98c3fb1c46f6be09a1a5860340822ae9f5a6ecd (diff) | |
| download | constance-ring-6a37ba289436cc09270cf63810888acb7df53002.tar.gz constance-ring-6a37ba289436cc09270cf63810888acb7df53002.tar.bz2 constance-ring-6a37ba289436cc09270cf63810888acb7df53002.tar.xz constance-ring-6a37ba289436cc09270cf63810888acb7df53002.zip | |
Reorganizing awk code
Diffstat (limited to 'stage-4.awk')
| -rw-r--r-- | stage-4.awk | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/stage-4.awk b/stage-4.awk new file mode 100644 index 0000000..84f2700 --- /dev/null +++ b/stage-4.awk @@ -0,0 +1,24 @@ +# awk +{ + while (match($0, /-$/)) { + # Drop line continuation + gsub(/-$/, "") + + # Print the line, without newline + printf "%s", $0 + + # Get the next line, skipping blank lines + do { + getline + } while($0==""); + + # Print the first word + printf "%s\n", $1 + + # Drop the first word, remove leading whitespace + $1="" + sub(/^[ \t]+/, "") + } + + print +} |
