• 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: Chris Espinosa <email@hidden>
  • Date: Fri, 12 Nov 2004 15:35:25 -0800

On Nov 12, 2004, at 2:04 PM, Paul Berkowitz wrote:

In this particular case, all I want is the number of lines, not the file
name which wc -l adds on to the end. I guess you could remove that with a
grep. Gnarlodius sent me:


do shell script "sed -n '$=' /SystemProfile.txt"

which works perfectly. (In fact it gives the answer "1" when there's a Mac
file with no LFs. whereas wc -l says the answer is "0", which is
interesting.)

If you want to handle both Mac and Unix files, use tr:

cat ./SystemProfile.txt | tr \r \n | wc -l

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

  • Prev by Date: Re: Count lines
  • Next by Date: Re: strcat in applescript?
  • Previous by thread: Re: Count lines
  • Next by thread: Re: Count lines
  • Index(es):
    • Date
    • Thread