procedure tgroup (file_name, n, x, y) string file_name {prompt="Input file containing a stream of words"} real n {prompt="Number of lines over which group pattern is repeated"} real x {prompt="First line (of group) to include"} real y {prompt="Last line (of group) to include"} struct *flist begin string nthWORD struct currentWORD real j # counter real Y real Yint flist = file_name j = 0. while (fscan (flist, currentWORD) != EOF) { j=j+1. if (j > n) { j = 1. } if ((j >= x) && (j <= y)) { print (currentWORD) } } end