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

Re: Count lines


  • Subject: Re: Count lines
  • From: "John C. Welch" <email@hidden>
  • Date: Fri, 12 Nov 2004 20:16:33 -0600

On 11/12/2004 19:51, "Paul Berkowitz" <email@hidden> wrote:

>>> That doesn't work when I have Windows files: it inserts an extra blank line
>>> for the CR part of the CRLF. The whole point of what I'm doing here is to
>>> see if there's more than 1 LF-delimited "line" in the file: if there is,
>>> then it's a Windows or Unix file and further sed operations will work on it.
>>> If it's a Mac file that has only one "line" (as far as sed is concerned),
>>> _that's_ when I need to replace \r with \n before I can proceed. I
>>> especially do not want to do the \n replacement for Windows files.
>>>
>>
>> This is why I pay for BBEdit. Click the button, read the number.
>
> Thanks, John. I understand. But that's of absolutely no interest or
> relevance when a script I wrote is running on other people's machines. I
> meant "programmatically" when I asked the question, but I didn't say so -
> sorry.

That would have had an effect on my answer, since then I would have seen
"simplest programmatically way". The relevance or interest of my answer is
based on the quality of the question. Or to put it more simply, "Reading
minds ain't in my job description".

> As I've just described a few times by now, it's actually my script -
> not I - that needs to know the answer. Fortunately for me, others understood
> and replied with solutions I can use. I'll bear it in mind that BBEdit
> counts lines, though. (So does Tex-Edit Plus and some other editors I know.)
> I'm not at all surprised. Thanks for the suggestion.

BBEdit does all kinds of glorious things to text, in some cases, things that
you'd need 3-4 unix utilities and many hours with the man pages to do. It
also transparently handles line endings so you don't have to remember which
bizarre characters to search for based on the possible origin of the file. I
would assume, although I don't have a clue as to how to script it, that
EMACS will handle line endings in a similarly transparent way, and it's safe
to assume it's going to be on any Mac your script will run on. BBEdit is
what EMACS would be if EMACS had a decent UI.

john

--
"Sometimes it is entirely appropriate to kill a fly with a sledge hammer."
- Major Holdridge, 1994



 _______________________________________________
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: 
 >Re: Count lines (From: Paul Berkowitz <email@hidden>)

  • Prev by Date: Re: Count lines
  • Next by Date: Re: Count lines
  • Previous by thread: Re: Count lines
  • Next by thread: FMP crashes on get cell
  • Index(es):
    • Date
    • Thread