The logic is as follows.
From an apache file called /etc/hos.conf I need to retrieve the following information.
The account types etc. Basic, Standard, Master and the amount of databases they are allowed to have.
/etc/hos.conf
AccountTypes
#AccountType=name,perl,php,mailboxes,aliases,telnet,memory,frontpage,mysql,transfer,subdomains
AccountType=basic,0,1,25,100,0,50,0,0,100000,0,here
AccountType=standard,0,1,25,100,1,100,1,1,100000,0
AccountType=advanced,1,1,25,100,1,200,1,2,100000,0
AccountType=master,1,1,25,100,1,400,1,5,100000,0
AccountType=parkeddomain,0,0,1,10,0,0,0,0,0,0
AccountType=micro,0,0,1,5,0,1,0,0,300,0
AccountType=micropro,0,0,5,20,0,5,0,0,300,0
I use the following coding to do this.
$cmd = sprintf( "/bin/grep -e \"Account\" /etc/hos.conf | cut -d= -f2 | awk -F, ' { if ($9 > 0) print $1, $9} ' | xargs echo -n 2>/dev/null" );
$result = system ($cmd);
$array = explode(" ", $result);
Now all the values are stored in $array ....
I just need to re-arrange.