Wonderful! I've been wanting to convert this darned script for two
years, so I'm glad I finally asked!
After setting $inputArray as Dennis indicated, all I had to do was
change my main content variable to:
$content = implode("", $inputArray);
and make a few other minor changes (no more need to write to a new
file, etc.), and the filter was good to go.
Thank you both!
- Peter
On Mar 26, 2008, at 12:46 PM, Dennis wrote:
On Mar 26, 2008, at 10:38 AM, Peter Weil wrote:
What would it take to turn this script into a local BBEdit Unix
filter? In particular, what variable do I need to use for content
of the file to be filtered?
BBEdit Unix Filters place the selected text in a temp file and pass
the path of the temp file in $argv[1]. You can use PHP's "file"
function to read the file into an array, one line per element:
----------
#!/usr/bin/php
<?php
$inputArray = file ($argv[1]);
$i = 0;
foreach ($inputArray as $line)
{
$i++;
}
$output = "Number of lines: " . $i . "\n";
?>
----------
Hope this helps,
Dennis
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <[EMAIL PROTECTED]>
--
Peter Weil, Web Developer
University Communications
University of Wisconsin-Madison
Phone: 608-262-6538
Email: [EMAIL PROTECTED]
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <[EMAIL PROTECTED]>