Re: [PHP] Re: Extracting data from exec() call

2011-06-14 Thread Tamara Temple
On Jun 14, 2011, at 1:30 PM, Ashley M. Kirchner wrote: On 6/14/2011 12:03 PM, Shawn McKenzie wrote: --or to search for wmax = if($array = preg_grep('/^ wmax = $/', $output)) { $wmax = explode(', ', $array[0]); } array_shift($wmax); print_r($wmax); May need some more error checking. Ye

[PHP] Re: Extracting data from exec() call

2011-06-14 Thread Shawn McKenzie
On 06/14/2011 01:30 PM, Ashley M. Kirchner wrote: > if ($array = preg_grep('/^ wmax = /', $output)) { > $array = array_values($array); > $wmax = explode(', ', $array[0]); > } Sorry, didn't have a way to test when I posted. So you've posted two different expected outputs and

[PHP] Re: Extracting data from exec() call

2011-06-14 Thread Ashley M. Kirchner
On 6/14/2011 12:03 PM, Shawn McKenzie wrote: --or to search for wmax = if($array = preg_grep('/^ wmax = $/', $output)) { $wmax = explode(', ', $array[0]); } array_shift($wmax); print_r($wmax); May need some more error checking. Yeah, error checking ... Can't search for '/^ wmax $/

[PHP] Re: Extracting data from exec() call

2011-06-14 Thread Shawn McKenzie
On 06/14/2011 01:03 PM, Shawn McKenzie wrote: > $wmax = explode(', ', $output[count($output)-1]); Should be -2 :( $wmax = explode(', ', $output[count($output)-2]); -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php

[PHP] Re: Extracting data from exec() call

2011-06-14 Thread Shawn McKenzie
On 06/14/2011 12:35 PM, Ashley M. Kirchner wrote: > > I'm trying to extract data coming from an exec() call. The exec() > call is performing an ncdump on a netCDF file: > >$filename = "mlab.20110101.cdf"; > exec("/usr/bin/ncdump -l 2048 -v wmax ".$filename, $output); > ec