Count lines
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