Note Submitter: Reinhard at Neidl dot net
----
To place a php-script in a pipe you can use:
xargs -d "\n" ./mysrcipt.php --foo
With many lines/args the ./myscript.php will be called a couple times, but always with --foo.
e.g.:
./myscript.php:
#!/bin/php
<?php
foreach($args as $key => $value){
echo "\n".$key.":".$value;
}
?>
cat -n1000 /path/file | xargs -d "\n" ./myscript.php --foo | less
will call the script two times with echo to stdout/less:
0:./myscript
1:--foo
2:[file-line1]
3:[file-line2]
...
800:[file-line799]
0:./myscript
1:--foo
2:[file-line800]
...
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.