home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / cmplngmg / cl_jun89.arc / AWK210.ARC / SEQ.AWK < prev    next >
Text File  |  1988-02-25  |  443b  |  16 lines

  1. # seq - print sequences of integers
  2. #   input:  arguments q, p q, or p q r;  q >= p; r > 0
  3. #   output: integers 1 to q, p to q, or p to q in steps of r
  4.  
  5. BEGIN {
  6.     if (ARGC == 2)
  7.         for (i = 1; i <= ARGV[1]; i++)
  8.             print i
  9.     else if (ARGC == 3)
  10.         for (i = ARGV[1]; i <= ARGV[2]; i++)
  11.             print i
  12.     else if (ARGC == 4)
  13.         for (i = ARGV[1]; i <= ARGV[2]; i += ARGV[3])
  14.             print i
  15. }
  16.