The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 11-22-2008
wakhan wakhan is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 58
How to put for loop in nawk

Hello All,

How i can put loop in nawk. what i want is that i define a variable which contain vlaues like var='1 2 3 4 5' and then define for loop which gives vlaue to nawk one by one to varilable inside nawk and then print it.

Code:
cat /omp-data/logs/5etr/081121.APX | nawk -v CDNLIST='700 701' '

BEGIN {
for LIST in $CDNLIST
do
        TG=$LIST;
        printf ("DATE IN ST EN  TGN ISEIZE ISATMP   IANS OATMPT   OVFL OSEIZE OSATMP   OANS TOTUSG OOSMTCE   OOS DBLSZR
NTWCONG\n");
done
}
Regards,
Waqas Ahmed