Skip to main content
2 of 2
added 13 characters in body
iruvar
  • 17k
  • 8
  • 51
  • 81

It would appear that you're looking to cycle through the contents of the smaller file

With awk

awk 'NR == FNR{a[++i]=$0; next}; {print $0, a[FNR % i? FNR % i: i]}' smaller_file larger_file 

And python

from itertools import cycle, izip with open('larger_file') as f1, open('smaller_file') as f2: z = izip(f1, cycle(f2)) for l, m in z: print l.rstrip('\n'), m.rstrip('\n') 
iruvar
  • 17k
  • 8
  • 51
  • 81