[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
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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
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
RE: [PHP] Regular Expressions? Help!
Perhaps it is how I am calling the $lines in a while loop.? I have tried `$cmd`, exec(), exec($cmd, $ouput) (to capture the output as an array), system(), shell_exec(). None of them let me capture the STDOUT from the program. There has to be a way to do this. Anyone? Thanx -Original Message- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 2:07 PM To: 'Walker, Roy'; '[EMAIL PROTECTED]' Subject:RE: [PHP] Regular Expressions? Help! exec() -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
RE: [PHP] Regular Expressions? Help!
The cmd is running running correctly as I see the output on the screen (this is being run from a command line). The command output is seen on the screen and nothing gets set to $output. -Original Message- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 2:50 PM To: 'Walker, Roy'; '[EMAIL PROTECTED]' Subject:RE: [PHP] Regular Expressions? Help! exec() works for me. Remember, though, it returns only the LAST line. Have you tried the following to ensure it's constructing the command you think it is: $mycmd = $prog $cmdline $trimline ; print $mycmd; $output = exec($mycmd); -Original Message- From: Walker, Roy [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 2:27 PM To: 'Rick Emery'; '[EMAIL PROTECTED]' Subject: RE: [PHP] Regular Expressions? Help! Perhaps it is how I am calling the $lines in a while loop.? I have tried `$cmd`, exec(), exec($cmd, $ouput) (to capture the output as an array), system(), shell_exec(). None of them let me capture the STDOUT from the program. There has to be a way to do this. Anyone? Thanx -Original Message- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 2:07 PM To: 'Walker, Roy'; '[EMAIL PROTECTED]' Subject:RE: [PHP] Regular Expressions? Help! exec() -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
RE: [PHP] Regular Expressions? Help!
Sorry. Yes. It looks exactly like it should. And I see the ouput from the command like it should on the screen, I just can't capture it in the script. -Original Message- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 2:59 PM To: 'Walker, Roy'; '[EMAIL PROTECTED]' Subject:RE: [PHP] Regular Expressions? Help! Again, I ask: Does $mycmd contain the command you expect to see $mycmd = $prog $cmdline $trimline ; print $mycmd; $output = exec($mycmd); -Original Message- From: Walker, Roy [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 2:56 PM To: 'Rick Emery'; '[EMAIL PROTECTED]' Subject: RE: [PHP] Regular Expressions? Help! The cmd is running running correctly as I see the output on the screen (this is being run from a command line). The command output is seen on the screen and nothing gets set to $output. -Original Message- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 2:50 PM To: 'Walker, Roy'; '[EMAIL PROTECTED]' Subject:RE: [PHP] Regular Expressions? Help! exec() works for me. Remember, though, it returns only the LAST line. Have you tried the following to ensure it's constructing the command you think it is: $mycmd = $prog $cmdline $trimline ; print $mycmd; $output = exec($mycmd); -Original Message- From: Walker, Roy [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 2:27 PM To: 'Rick Emery'; '[EMAIL PROTECTED]' Subject: RE: [PHP] Regular Expressions? Help! Perhaps it is how I am calling the $lines in a while loop.? I have tried `$cmd`, exec(), exec($cmd, $ouput) (to capture the output as an array), system(), shell_exec(). None of them let me capture the STDOUT from the program. There has to be a way to do this. Anyone? Thanx -Original Message- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 2:07 PM To: 'Walker, Roy'; '[EMAIL PROTECTED]' Subject:RE: [PHP] Regular Expressions? Help! exec() -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
RE: [PHP] Regular Expressions? Help!
No. I think there is a carriage return (\n), but there is not a blank line at the end. -Original Message- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 3:07 PM To: 'Walker, Roy'; '[EMAIL PROTECTED]' Subject:RE: [PHP] Regular Expressions? Help! 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
RE: [PHP] Regular Expressions? Help!
The problem is that exec() is looking for an immediate output and since I am calling a command line program it doesn't return fast enough for it (I think). The popen or fopen looks like it would work, but I don't understand how to execute the command. Ie. ?php $cmd = ls -la $lines = file ($printers); while (list ($line_num, $line) = each ($lines)) { $trimline = trim ($line); $fp = popen ($cmd, r); exec($fp) echo npadmin output: $output\n; pclose ($fp); } ? -Original Message- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 4:30 PM To: 'Darren Gamble'; 'Walker, Roy'; '[EMAIL PROTECTED]' Subject:RE: [PHP] Regular Expressions? Help! exec() can capture ALL output from a command if you supply an array as the second argument to it -Original Message- From: Darren Gamble [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 3:58 PM To: 'Walker, Roy'; '[EMAIL PROTECTED]' Subject: RE: [PHP] Regular Expressions? Help! Good day, exec() isn't very good at capturing output. It will only return the last line of output, which is designed mostly to capture error conditions. You would be best off using popen() and attaching a pipe to the output, and then just read from the pipe. More information can be found about popen() with PHP's documentation. Try that instead. Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Walker, Roy [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 12: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 -- 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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP command line scripting multiple process forking
I have been playing with this for a couple of days and have run into a few issues: I am wanting to run a set number of multiple processes (ie 25 at a time). I can't use the exec command since it will not wait for the output (this is a delayed response - network based). $cmd = /path.to/some.cmd; $options = --options; $lines = file (/path.to/some.file); while (list ($line_num, $line) = each ($lines)) { $trimline = trim ($line); shell_exec ($cmd $options $trimline ); } This works but I want to fork it multiple times and have a set number of lines running at a time. Anyone have any ideas? Thank you, Roy Walker -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php