Question: I am using AQGridView in my project. we need to create a black colored border around each image. Can anyone help me on this. 

Thanks in advance.

Regards,
Jas.

Answer: 
You can create two user defined functions and use them as per your need. This will offer more generic solution. 

```
[jaypal:~/Temp] cat file
a  212
b  323
c  23
d  45
e  54
f  102
[jaypal:~/Temp] awk '
function max(x){i=0;for(val in x){if(i<=x[val]){i=x[val];}}return i;}
function min(x){i=max(x);for(val in x){if(i>x[val]){i=x[val];}}return i;}
{a[$2]=$2;next}
END{minimum=min(a);maximum=max(a);print "Maximum = "maximum " and Minimum = "minimum}' file
Maximum = 323 and Minimum = 23

```

In the above solution, there are 2 user defined functions - `max` and `min`. We store the column 2 in an array. You can store each of your columns like this. In the `END` statement you can invoke the function and store the value in a variable and print it. 

Hope this helps!

**Update:**

Executed the following as per the latest example - 

```
[jaypal:~/Temp] awk '
function max(x){i=0;for(val in x){if(i<=x[val]){i=x[val];}}return i;}
function min(x){i=max(x);for(val in x){if(i>x[val]){i=x[val];}}return i;}
/^#/{next}
{a[$6]=$6;next}
END{minimum=min(a);maximum=max(a);print "Maximum = "maximum " and Minimum = "minimum}' sample
Maximum = 222 and Minimum = 3.01

```
The min can be found by:

```
awk 'BEGIN {min=1000000; max=0;}; { if($2<min && $2 != "") min = $2; if($2>max && $2 != "") max = $2; } END {print min, max}' file

```

This will output the minimum and maximum, comma-separated