• 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: Search a file question - Mac OS 9
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Search a file question - Mac OS 9


  • Subject: Re: Search a file question - Mac OS 9
  • From: Emmanuel <email@hidden>
  • Date: Wed, 18 Sep 2002 10:06:44 +0200

On Tuesday, September 17, 2002, at 07:24 PM, Charles Heizer wrote:

Hello,
I'm having some trouble getting a script to read a log file to work properly.

I'm trying to find any line that that contains "RC [someerror]" for example. Then write that line with it's line number out to a new text file. The thing is I don't want it to grab the lines that contain "RC [0]" because a return code of zero means there were no problems.

You will probably get plenty of helpful replies if you say what your trouble is.

Basically, you would:
- read the log file: use the "read" command of the Standard Additions.
- test "someerror": if you use only Apple components (and no 3rd party osax) you have to use AppleScript's text item delimiters and "text items of (a string)" coercion to extract "someerror", otherwise you will probably use the Regular Expressions which are most appropriate for this kind of job. Or, if you know exactly how the line is formatted you would pick the correct characters with "text 2 thru 2 of theLine", e.g. You can coerce a string such as "8" to integer, and then test whether it is null or not. (You can also test directly if the string is equal to the string "0")
- write the line: use the "write" command of the Standard Additions.

Emmanuel
_______________________________________________
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: 
 >Search a file question - Mac OS 9 (From: Charles Heizer <email@hidden>)

  • Prev by Date: Re: applescript-users digest, Vol 3 #858 - 16 msgs
  • Next by Date: Re: Macintosh Scripting
  • Previous by thread: Re: Search a file question - Mac OS 9
  • Next by thread: Re: Search a file question - Mac OS 9
  • Index(es):
    • Date
    • Thread