Re: Selecting Last X Lines of Shell Script Result
Re: Selecting Last X Lines of Shell Script Result
- Subject: Re: Selecting Last X Lines of Shell Script Result
- From: "Nigel Garvey" <email@hidden>
- Date: Tue, 27 May 2008 11:07:01 +0100
Michelle Steiner wrote on Mon, 26 May 2008 13:21:12 -0700:
>On May 26, 2008, at 1:01 PM, Marconi wrote:
>
>> When executing a shell script, how do I set the my_Message variable
>> to just the last X lines of the output?
>
>
>Assume that you want the last fifteen lines.
>
>set my_Message to (do shell script "ls -l /Applications")
>set my_Message to paragraphs -1 through -15 of my_Message
>set text item delimiters to return
>set my_Message to my_Message as text
>display dialog my_Message
Just to be finicky:
set my_Message to (do shell script "ls -l /Applications")
set my_Message to text from paragraph -15 to -1 of my_Message
Surprisingly, this is a trifle faster on my machine than Craig's all-
shell suggestion.
NG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden