Re: Line count of a referenced text file?
Re: Line count of a referenced text file?
- Subject: Re: Line count of a referenced text file?
- From: Matthew Broms <email@hidden>
- Date: Tue, 13 Nov 2001 11:53:41 -0400
Thanks to all for the feedback. I know and appreciate the delimiter
capabilities of text assigned to a variable, but I was hoping there might be
some subset of this functionality one could use for a referenced file since
my text file is quite large (16 meg). While I realize you can't pull much
out of a referenced file, you can get some good things like EOF, reading a
specific range of characters, or reading until return. This ability to read
until return, apparently a default delimiter one can reference, got me
wondering if I could change this default temporarily to something of my
choosing like "read until myDelim". Or perhaps the ability to count the
number of these default delimiters. After all, EOF is nothing more than a
count of the characters, so why not a count of delimiters to get a
line/paragraph count?
Oh well, would be nice, but it sounds like AS just doesn't offer it and I
don't want to puppet any outside programs. With everything getting so big
these days, seems like the text handling capabilities of large files might
be augmented. Wishful thinking I realize. I'll just do it the slow,
line-by-line way. Thanks again.
Matt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
From: "Marc K. Myers" <email@hidden>
>
Organization: [very little]
>
Reply-To: email@hidden
>
Date: Mon, 12 Nov 2001 23:28:15 -0500
>
To: email@hidden
>
Subject: Re: Line count of a referenced text file?
>
>
> Date: Mon, 12 Nov 2001 17:49:57 -0400
>
> Subject: Line count of a referenced text file?
>
> From: Matthew Broms <email@hidden>
>
> To: Applescript Users <email@hidden>
>
>
>
> Using purely AppleScript, can I get the line count of a text file using just
>
> a reference to it (NOT reading the contents into a variable)? If I can, can
>
> I get the count of any delimiter of my choosing? When I try to do a "count
>
> paragraphs", I get an error.
>
>
Without reading the text file into a variable you can't do anything with
>
it. A reference to a file has to do with the file system (i.e. the file
>
as an entity), not with the contents of the file.
>
>
After you've read the text file into a variable you can use
>
AppleScript's text item delimiters to parse the text into paragraphs by
>
setting AppleScript's text item delimiters to "return". Then you can
>
count the number of items in the resulting list.
>
>
Marc K. Myers <email@hidden>
>
http://AppleScriptsToGo.com
>
4020 W.220th St.
>
Fairview Park, OH 44126
>
(440) 331-1074
>
>
[11/12/01 11:27:38 PM]
>
_______________________________________________
>
applescript-users mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/applescript-users