Subject: | |
From: | |
Reply To: | |
Date: | Mon, 1 Jan 2007 11:42:09 +0900 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Hello Olof,
On Dec 31, 2006, at 6:45 PM, Olof Svensson wrote:
> and how do I the pipe the result to a new BBEdit-file
I think the simplest is to make your script an AppleScript, and call
your bash script from within it, using "do shell script".
I don't know how you can get the result of the bash script in
AppleScript, but probably you could use "echo"?? In Perl, your
script would be something like this (note "$res = `grep -v $ip2
$res`;" -- I follow Mark's reasoning):
set perl_scpt to "$alog="/private/var/log/httpd/access_log";
$ip1="127.0.0.1";
$ip2="192.168.0.101";
$res = `grep -v $ip1 $alog`;
$res = `grep -v $ip2 $res`;
print $res;"
set res to (do shell script "perl -e '" & perl_scpt & "'")
if not (res is missing value) then
tell application "BBEdit"
make new text document with properties ¬
{contents:res, name:"grep_result"}
activate
end tell
end if
Please note that I didn't test this script.
By the way, I am not sure how "grep" works, but perhaps you should
escape the "." in your search expressions. In that case, that would be:
$ip1="127\\.0\\.0\\.1";
$ip2="192\\.168\\.0\\.101";
I hope this helps.
Best regards,
Nobumi Iyanaga
Tokyo,
Japan
|
|
|