Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Awk > Re: Extract a f...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 7 Topic 2184 of 2317
Post > Topic >>

Re: Extract a field in a string collection

by "Scott S. McCoy" <tag@[EMAIL PROTECTED] > Mar 11, 2008 at 12:49 AM

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, "', '")
> }
 




 7 Posts in Topic:
Extract a field in a string collection
Radu <raducocos@[EMAIL  2008-03-10 17:20:34 
Re: Extract a field in a string collection
Tiago Peczenyj <tiago.  2008-03-10 17:26:33 
Re: Extract a field in a string collection
Ed Morton <morton@[EMA  2008-03-11 00:20:35 
Re: Extract a field in a string collection
"Scott S. McCoy"  2008-03-11 00:46:42 
Re: Extract a field in a string collection
Ed Morton <morton@[EMA  2008-03-11 00:29:04 
Re: Extract a field in a string collection
"Scott S. McCoy"  2008-03-11 00:49:14 
Re: Extract a field in a string collection
Ed Morton <morton@[EMA  2008-03-10 21:24:49 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 15:10:54 CDT 2008.