![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 80 chars limit for params | broli | SUN Solaris | 2 | 12-19-2008 09:05 AM |
| Solaris 10 kernel Params, Set/Get? | NewSolarisAdmin | SUN Solaris | 8 | 12-12-2008 05:40 PM |
| script takes params | keromotti | Shell Programming and Scripting | 2 | 06-06-2008 08:15 AM |
| evaluating params | abzi | UNIX for Dummies Questions & Answers | 3 | 11-22-2005 11:40 PM |
| Change params for time zone | agustincm | UNIX for Advanced & Expert Users | 7 | 04-05-2005 05:40 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Does awk ever resolve params ?..
Hi, Does awk ever resolve params in the search pattern?.. The following awk doesnt know how to resolve ${tables[$j]}$ inside a loop. Code:
k=`awk '/${tables[$j]}$/ ${graph[$i]}`
The search pattern has ${tables[$j]}$ and I am narrowing down my search with a $ at the end of string. So...this leaves me with a question on if awk ever resolve the params in the search patterns?...I am sure it resolves in other places...like in this case ${graph[$i]} Thx ! |
|
||||
|
Hi vgersh, "${tables[$j]}" and "${graph[$i]}" are 2 arrays holding 2 distinct sets of elements like table list and graph list. A simplified code snippet giving a better idea... Code:
#! /bin/ksh
count1=`ls -lart P*.ksh | awk '{print $9}' | wc -l`
list1="`ls -lart P*.ksh | awk '{print $9}'`"
set -A graph $list1
count2=`wc -l read_table.dat | awk '{print $1}'`
list2="`cat read_table.dat`"
set -A tables $list2
j=0
while ((j<$count2))
do
i=0
while ((i<$count1))
do
k=`awk '/ETL_VW_SCHEMA/ && /[.]${tables[$j]}$/ || /EDW_DB_SCHEMA/ && /[.]${tables[$j]}$/' ${graph[$i]}`
((i=i+1))
done
((j=j+1))
done
Awk in the inner most loop doesnt resolve ${tables[$j]} during the run time....but no issues with ${graph[$i]}. Hope this gives a better idea on the problem... Thx ! |
|
|||||
|
Quote:
Why are you using the -a option? Your pattern cannot match any dot files. In fact you are using more than 2 UECs: Code:
set -- P*.ksh count1=$# list1=`ls -rt P*.ksh` Quote:
Quote:
Quote:
Quote:
|
|
||||
|
Hi Johnson/Vgersh, Thank you very much for the suggestions and the pointers.. But my shell errors out with the awk syntax....here are some quick details on my OS and the actual error itself...I tried switching my shell to ksh and run it but still errors out the same way as mentioned below. Code:
$ awk -v t="B1_STAT_HIST" '/ETL_VW_SCHEMA/ && $0 ~ ("[.]" t "$") || /EDW_DB_SCHEMA/ && $0 ~ ("[.]" t "$")' PDEWG300_B1_STAT_HIST.ksh
awk: syntax error near line 1
awk: bailing out near line 1
$ uname -a
SunOS xspetl01 5.8 Generic_117350-36 sun4u sparc SUNW,Sun-Fire-480R
Appreciate your suggestions ! Thx ! |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|