Currently Being ModeratedMay 12, 2012 11:55 AM (in response to personal_username)
wc -l < MyFile.txt
Will count the number of lines in the file MyFile.txt. If you are going to write a script with AppleScript then try to stay in AppleScript ( don't spawn another process). I don't script in AppleScript, so I'm not much help beyond that.
Currently Being ModeratedMay 12, 2012 1:51 PM (in response to personal_username)
the way to do this in applescript is as follows:
set contentsText to read "/path/to/file.txt"
set mywordcount to count of words of contentText
that will return an integer value. if you want to use the do shell script approach, keep in mind that dss always returns text, so you'll want to coerce the text value to an integer:
set mywordcount to (do shell script "wc -l < MyFile.txt") as integer
Currently Being ModeratedMay 12, 2012 4:10 PM (in response to personal_username)
NOTE: wc -l is a line count and wc -w is a word count. You post is mixing apples and oranges in that you ask for word count then post an example of using wc with a line count.