• 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: Christopher Nebel <email@hidden>
  • Date: Thu, 16 Sep 2004 18:07:20 -0700

On Sep 16, 2004, at 5:54 PM, Gnarlodious wrote:

Entity Stefan Eriksson spoke thus:

> 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 ?


set filePath to POSIX path of (choose file)
do shell script "cat " & the quoted form of filePath & " | tr '\\r' '\\n' | sed -n '$=' "

"sed -n '$='" is equivalent to "wc -l".


--Chris Nebel AppleScript Engineering _______________________________________________ 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:
    • Re: Count lines in a textfile
      • From: Martin Orpen <email@hidden>
    • Re: Count lines in a textfile
      • From: Doug McNutt <email@hidden>
References: 
 >Re: Count lines in a textfile (From: Gnarlodious <email@hidden>)

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