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

Count lines


  • Subject: Count lines
  • From: Paul Berkowitz <email@hidden>
  • Date: Fri, 12 Nov 2004 12:37:21 -0800

What's the simplest way to count unix lines of a text file?

I need to look at some enormous mbox-type files which may have CR Mac line
endings, or CRLF Windows line endings, or just possibly (unlikely) plain LF
Unix line endings. If the files weren't so enormous I'd just read them in
AppleScript, get paragraphs, and use LF as text item delimiter and put them
back as a string. (I then need to do some sed operations on the text.) But
it runs into problems, especially in Jaguar where 'paragraphs' till has the
> 4000 -item problem.

I don't want to replace the CRs with LFs via tr in the case (very likely)
that these files have CRLF line endings - that inserts empty lines if I do
that. But if counting Unix lines results in just 1 line - i.e. it's a Mac
file with only CR endings so it all appears as one line to Unix utilities -
then I will tr \r \n .

--
Paul Berkowitz


 _______________________________________________
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

  • Follow-Ups:
    • FMP crashes on get cell
      • From: Xandra Lee <email@hidden>
    • Re: Count lines
      • From: "John C. Welch" <email@hidden>
  • Prev by Date: Re: computing 20! all the way
  • Next by Date: Re: Count lines
  • Previous by thread: Re: computing 20! all the way
  • Next by thread: Re: Count lines
  • Index(es):
    • Date
    • Thread