The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 12-04-2007
user_prady user_prady is offline
Registered User
 

Join Date: Sep 2007
Posts: 163
Quote:
Originally Posted by gus2000 View Post
Code:
awk 'BEGIN{a[1]="abc";a[2]="def";print length(a)}'
2
Once you know the number of elements, you can use a for loop.
Thanks for the reply ,, Yes I do know how many elements are in the array,
but my problem is to print it in one variable

suppose if my number of elements in the array is 3 ,then my commnad should look like this
Code:
input = sprint line[1] line[2] line[3]
On the other hand if the number of array element increases suppose to 4 then my command should look like
Code:
input = sprint line[1] line[2] line[3] line[4]
and like wise you can see the sprint line is varying with the index number..

That is my basic need .. pls help..
Reply With Quote