printing array in awk
is there anyway i can print out all elements of an array in awk without knowing what the indices are? or even indices and elements pairs for that matter. i thought about using a for loop but without knowing what the indices are i don't know how to do it.
|
If the indices are numeric and sorted
Code:
for (i = 1; i <= length(array); i++) If the indices are made of unsorted alphanumeric strings you can simply do Code:
for (i in array) |
nevermind guess you edited your post ^^
|
For what it's worth, even if you have a multi-dimensional array a simple change to colucix's suggestion could be used:
Code:
for (index in array) { Note: Some of the above is specific to gawk, and may not be portable. |
All times are GMT -5. The time now is 07:46 AM. |