Oct 22, 2002 #1 lambros Programmer Oct 10, 2002 42 US Hi, How do I search $0 for the value of an array? my script uses; reg[1] = var then later I have; for (i in reg) print reg This works fine; how can I search $0 for this value; can I do; if ($0 ~ /reg/) ?
Hi, How do I search $0 for the value of an array? my script uses; reg[1] = var then later I have; for (i in reg) print reg This works fine; how can I search $0 for this value; can I do; if ($0 ~ /reg/) ?
Oct 22, 2002 #2 CaKiwi Programmer Apr 8, 2001 1,294 US I assume this is awk. Your post is garbled because the Code: [i] turned on italics. (uncheck the process TGML box or use j instead of i). But if I understand your post correctly, the answer is yes. CaKiwi Upvote 0 Downvote
I assume this is awk. Your post is garbled because the Code: [i] turned on italics. (uncheck the process TGML box or use j instead of i). But if I understand your post correctly, the answer is yes. CaKiwi
Oct 22, 2002 #3 CaKiwi Programmer Apr 8, 2001 1,294 US Upon further review, I now think the answer is no. Remove the slashes. Code: if ($0 ~ reg[i]) ... CaKiwi Upvote 0 Downvote
Upon further review, I now think the answer is no. Remove the slashes. Code: if ($0 ~ reg[i]) ... CaKiwi
Oct 22, 2002 Thread starter #4 lambros Programmer Oct 10, 2002 42 US Hi CaKiwi, I've also tried this & it works to a point, however if I elaborate on it & do if ($0 ~ reg && /78/) it doesn't return anything, even thought this works on the command line ( when I insert the values returned by print reg... do you know why this is? Upvote 0 Downvote
Hi CaKiwi, I've also tried this & it works to a point, however if I elaborate on it & do if ($0 ~ reg && /78/) it doesn't return anything, even thought this works on the command line ( when I insert the values returned by print reg... do you know why this is?
Oct 23, 2002 #5 jad Programmer Apr 7, 1999 1,195 GB Code: if ($0 ~ reg[i] && $0 ~ /78/) Upvote 0 Downvote