• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Shared folders, WAS Checking for logged on guests
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shared folders, WAS Checking for logged on guests


  • Subject: Re: Shared folders, WAS Checking for logged on guests
  • From: Graff <email@hidden>
  • Date: Sat, 03 Jan 2004 23:17:38 -0500

On Jan 3, 2004, at 6:46 PM, Martin Orpen wrote:

Graff <email@hidden> wrote:

I think you can do all that with just adding awk to your "do shell
script". The awk tool splits a line up into text fields seperated by
white space. Since you are really only interested in field 5 you can
just add "| awk '{print $5}'" to your "do shell script" command
-----------
set theUserList to {}
set theUsers to do shell script "netstat -na | grep '\\.548' | awk
'{print $5}'"

[snip]

Why use grep & awk?

set theUsers to do shell script "netstat -na | awk '/.548/ {print $5}'"

Would do the trick wouldn't it?

Well I'll be... I missed that one, nice catch! That works out fine. I didn't see the /re/ thing for making a regular expression constant but now that I know about it I can see it mentioned in the man page for awk.

The only thing I would do is change that line to:
set theUsers to do shell script "netstat -na | awk '/\\.548/ {print $5}'"

So that it would catch only the string ".548" and not just any character & "548". That way it wouldn't get just any line with the number 548 in it

Thanks, I'll be sure to use that in the future!

- Ken
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Shared folders, WAS Checking for logged on guests (From: Martin Orpen <email@hidden>)

  • Prev by Date: Re: are WeatherPop running
  • Next by Date: Rez Documentation
  • Previous by thread: Re: Shared folders, WAS Checking for logged on guests
  • Next by thread: File sharing quits by itself
  • Index(es):
    • Date
    • Thread