MACSCRPT Archives

December 2006

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Mime-Version:
1.0 (Apple Message framework v752.2)
Sender:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Mon, 1 Jan 2007 11:42:09 +0900
Reply-To:
Macintosh Scripting Systems <[log in to unmask]>
Subject:
From:
Nobumi Iyanaga <[log in to unmask]>
Content-Transfer-Encoding:
quoted-printable
In-Reply-To:
Content-Type:
text/plain; charset=ISO-8859-1; delsp=yes; format=flowed
Comments:
Parts/Attachments:
text/plain (47 lines)
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

ATOM RSS1 RSS2