File: b2l.awk

package info (click to toggle)
saclib 2.2.8-6.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,872 kB
  • sloc: ansic: 40,932; csh: 1,190; asm: 541; awk: 320; sh: 246; perl: 116; makefile: 98; sed: 48
file content (21 lines) | stat: -rwxr-xr-x 561 bytes parent folder | download | duplicates (32)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/^[^ ]/ {
  # FILE
  #   b2l.awk - concatenates a block of text to a single line.
  #
  # FUNCTION
  # Takes an input file which consists of one or more blocks of the
  # following format:
  #
  # <subject> <text>
  #   <0 or more lines of additional text beginning with at least one blank>
  #
  # and outputs each of these block as a single line of text.

  if (subcnt != 0)
    printf("%s %s\n",subject,text);
  subject = $1; 
  text = substr($0,length($1)+2,length($0)-length($1)-1);
  subcnt++;
}
/^ / {text = text $0}
END {printf("%s %s\n",subject,text)}