#! /usr/bin/gawk -f # Input is a list of words "w[1]", .. "w[n]", one per line. # Output is a list of all pairs of consecutive words, # "w[i-1] w[i]" for all i in [1..n], one per line. # The two words in each pair are separated by a space. # The word "w[0]" on the first pair is "=" by convention. BEGIN { want = "=" } /./ { print (want " " $0) want = $0 next }