On Tue, 11 Mar 2008 00:46:42 +0000, Scott S. McCoy wrote:
> function join(array, start, end, sep, result, i) {
> if (sep == "")
> sep = " "
> else if (sep == SUBSEP) # magic value
> sep = ""
> result = array[start]
> for (i = start + 1; i <= end; i++)
> result = result sep array[i]
> return result
> }
>
> BEGIN {
> # Assuming it's a comma or tab using CSV FS = ",|\t"
These aren't supposed to be on the same line, must have been a copy and
paste f-up... Here's an online paste.
http://awkpaste.blisted.org/cgi/paste.cgi?id=73
> }
> { list[NR] = $NF }
> END {
> printf "WHERE field IN ('%s')\n", join(list, 1, NR, "', '")
> }


|