#! /usr/bin/gawk -f

# Usage: "$0 [ -vWPB=nnn ] < INFILE > OUTFILE"

# Reads a list of words
# Writes a list of lines of the form BLOCKNUM WORD where
# BLOCKNUM is the block serial number (from 1)
# Currently, a block is defined as WPB consecutive words.

BEGIN { NBLOCK = 1; TOTW = 0; 
  if (WPB == 0) WPB = 100
}

/./ {
  TOTW++;
  printf "%5d %s\n", NBLOCK, $(i)
  if ( ( TOTW % WPB ) == 0 ) NBLOCK++
  next
}