When the exec'd program executes from the command line, does it output a blank line as its last line?
-----Original Message----- From: Walker, Roy [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 2:05 PM To: '[EMAIL PROTECTED]' Subject: RE: [PHP] Regular Expressions? Help! I just realized why nothing I was trying for the regular expressions wasn't working. The command I am running is a C program on the command line of a Linux box. I can't capture the output, it just gets output onto the screen. I just echo'd $output after the command was run and it was empty. Any ideas? -----Original Message----- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 1:54 PM To: 'Walker, Roy' Subject: RE: [PHP] Regular Expressions? Help! well, ya might try: $my_array = explode( "\" ",$output); this would set: $my_vars[0] = "variable1:\"some text info\"" $my_vars[1] = "variable2:\"some text info\"" then, you can do an explode on each of the my_vars another, which might work: <?php $output = "variable1:\"some information\" variable2:\"some information\""; ereg( "(variable[0-9]*):\"(.*)\" (variable[0-9]*):\"(.*)\"", $output, $regs); print "output = $output\n"; print $regs[0]." - 0\n"; print $regs[1]." - 1\n"; print $regs[2]." - 2\n"; print $regs[3]." - 3\n"; print $regs[4]." - 4\n"; ?> WHEN EXECUTED DISPLAYS THIS: C:\>php -q zz.php\ output = variable1:"some information" variable2:"some information" variable1:"some information" variable2:"some information" - 0 variable1 - 1 some information - 2 variable2 - 3 some information - 4 -----Original Message----- From: Walker, Roy [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 1:31 PM To: 'Rick Emery' Subject: RE: [PHP] Regular Expressions? Help! There will be a specific number of variables returned. I just wanted to set all the output to a string and just run through it to grab the variables. Thanx -----Original Message----- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 1:28 PM To: 'Walker, Roy'; '[EMAIL PROTECTED]' Subject: RE: [PHP] Regular Expressions? Help! With there be a specifc number of variables returne? Or can the number of variables vary? -----Original Message----- From: Walker, Roy [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 1:26 PM To: '[EMAIL PROTECTED]' Subject: [PHP] Regular Expressions? Help! I am trying to do a match for an expression and it to a variable from the output of a command: <?php $lines = file ($file); while (list ($line_num, $line) = each ($lines)) { $trimline = trim ($line); $output = shell_exec ("$prog $cmdline $trimline &"); } ?> How can look through $output to set the information returned as different variables the output would look like: variable1:"some information" variable2:"some information" I want to set each variable to a string and write it to a file. Thank You for you help. Roy ************************** PLEASE NOTE ************************** This E-Mail/telefax message and any documents accompanying this transmission may contain privileged and/or confidential information and is intended solely for the addressee(s) named above. If you are not the intended addressee/recipient, you are hereby notified that any use of, disclosure, copying, distribution, or reliance on the contents of this E-Mail/telefax information is strictly prohibited and may result in legal action against you. Please reply to the sender advising of the error in transmission and immediately delete/destroy the message and any accompanying documents. Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ************************** PLEASE NOTE ************************** This E-Mail/telefax message and any documents accompanying this transmission may contain privileged and/or confidential information and is intended solely for the addressee(s) named above. If you are not the intended addressee/recipient, you are hereby notified that any use of, disclosure, copying, distribution, or reliance on the contents of this E-Mail/telefax information is strictly prohibited and may result in legal action against you. Please reply to the sender advising of the error in transmission and immediately delete/destroy the message and any accompanying documents. Thank you. ************************** PLEASE NOTE ************************** This E-Mail/telefax message and any documents accompanying this transmission may contain privileged and/or confidential information and is intended solely for the addressee(s) named above. If you are not the intended addressee/recipient, you are hereby notified that any use of, disclosure, copying, distribution, or reliance on the contents of this E-Mail/telefax information is strictly prohibited and may result in legal action against you. Please reply to the sender advising of the error in transmission and immediately delete/destroy the message and any accompanying documents. Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ************************** PLEASE NOTE ************************** This E-Mail/telefax message and any documents accompanying this transmission may contain privileged and/or confidential information and is intended solely for the addressee(s) named above. If you are not the intended addressee/recipient, you are hereby notified that any use of, disclosure, copying, distribution, or reliance on the contents of this E-Mail/telefax information is strictly prohibited and may result in legal action against you. Please reply to the sender advising of the error in transmission and immediately delete/destroy the message and any accompanying documents. Thank you. ************************** PLEASE NOTE ************************** This E-Mail/telefax message and any documents accompanying this transmission may contain privileged and/or confidential information and is intended solely for the addressee(s) named above. If you are not the intended addressee/recipient, you are hereby notified that any use of, disclosure, copying, distribution, or reliance on the contents of this E-Mail/telefax information is strictly prohibited and may result in legal action against you. Please reply to the sender advising of the error in transmission and immediately delete/destroy the message and any accompanying documents. Thank you. ************************** PLEASE NOTE ************************** This E-Mail/telefax message and any documents accompanying this transmission may contain privileged and/or confidential information and is intended solely for the addressee(s) named above. If you are not the intended addressee/recipient, you are hereby notified that any use of, disclosure, copying, distribution, or reliance on the contents of this E-Mail/telefax information is strictly prohibited and may result in legal action against you. Please reply to the sender advising of the error in transmission and immediately delete/destroy the message and any accompanying documents. Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php