• 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: Count lines in a textfile
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Count lines in a textfile


  • Subject: Re: Count lines in a textfile
  • From: Michelle Steiner <email@hidden>
  • Date: Thu, 16 Sep 2004 17:03:44 -0700

On Sep 16, 2004, at 4:02 PM, Stefan Eriksson wrote:

Anyone got a tip on how to count number of lines in a text-document, i´ve been testing to read how many ASCII Character 10/13 there are in a text-file but can´t get some accurate figures out of it... any ideas ?

How do you define a line? There really is no such thing in text, so far as Applescript is concerned; there are characters, words, and paragraphs. Some applications may define more text entities in their dictionaries, though.


If a line is considered to be the same as a paragraph, then this will do it:

count paragraphs of the_text

Or will it? If there is double spacing between paragraphs, then that code will return approximately double the number of actual paragraphs because each blank line will be counted as a paragraph.

So before you can count the "lines" of a text file, you have to define "line."

-- Michelle

--
In theory, theory and practice are the same.
In practice, they're not. --Yogi Berra

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Count lines in a textfile (From: Stefan Eriksson <email@hidden>)

  • Prev by Date: Count lines in a textfile
  • Next by Date: Re: Count lines in a textfile
  • Previous by thread: Count lines in a textfile
  • Next by thread: Re: Count lines in a textfile
  • Index(es):
    • Date
    • Thread