I want to pass a 2D array as an argument to the function in awk . I tried this
add(element1,element2,array) -> this "array" could be bigArray,smallArray etc
function add(element1,element2,array)
{
if(!(element1 SUBSEP element2 in array))
{
array[element1,element2]
}
}
The array in the add function keeps on changing . But I am getting an error stating that “attempt to use scalar parameter array as an array”. But the same thing when I pass a 1D array it works. Could you ppl please help me regarding this
As commented just now, tested it with following script:
Content of
script.awk:Run it like:
With following output: