Array

from a command I got output as below:

abc
bcd
efg

How can I make these outputs in an array?

ksh93:

$ cat >INPUTFILE
abc
bcd
efg
$ a=(`cat INPUTFILE`)
$ echo ${a[1]}
bcd

Thanks for the help.

My need is to get the open ports in an array.

I get the open ports using the following command

netstat -anp | grep `ps -ef | grep catalina | grep -v "grep catalina" | grep -v "catalina.out" | awk '{print $2}' | head -1` | grep LISTEN | awk '{print $4}' | awk -F: '{print $NF}'

Output

I need these outputs in an array.

You can use any command (and a pipe) in the same way (in bash and ksh93):

array=(`cmd1 | cmd2`)
for i in $(ps -ef|grep catalina|grep -v grep|awk '{print $2}'); do AR=(${AR[@]} $(netstat -nlp|grep $i|sed 's/.*:\([0-9]*\)  *.*/\1/')); done
echo ARRAY="${AR[@]}"