Word Count in Unix
All my previous posts were related to the Windows-based word count software, but I thought that it is pretty unfair to forget about millions of UNIX users, so today we have a UNIX word count session.
Of course my UNIX experience is not that huge (it was all about testing a Fedora core under virtual machine), so below you will find mostly the reprints of the word count tips published in other Internet-media.
Word count using the “wc” command (taken from Wiki)
“wc” (short for word count) is a command in Unix-like operating systems. The program reads either standard input or a list of files and generates one or more of the following statistics: number of bytes, number of words, and number of lines (specifically, the number of newline characters). If a list of files is provided, both individual file and total statistics follow.
This is how to use the “wc” command:
• wc -l
• wc -c
• wc -m
• wc -L
• wc -w
Well, taking into consideration the languages that don’t use space mark, byte count will be very much appreciated by users from China, Japan and Thailand.
Word count without using the “wc” command (taken from computing.net)
After user Gburg inquired how to execute a loop to count each word in a file individually, without using the wc command, the following reply followed:
You can use the script below if your words are space seperated.
#!/bin/ksh
typeset -i I=0
{ while read line
do
for wort in `echo $line`
do
I=$I+1
done
done } < $1
echo $I
Many thanks to user Frank from everybody, except users from China, Japan and Thailand, for whom the script there should be another script
That's basically all for UNIX word count today.
P.S. Fans of the open source platforms will definitely like this video. Even such a Windows guy as me liked the trick
The subsequent time I read a blog, I hope that it doesnt disappoint me as much as this one. I mean, I know it was my option to learn, however I truly thought youd have something attention-grabbing to say. All I hear is a bunch of whining about something that you could repair in the event you werent too busy on the lookout for attention.
Comment by Adaline Marabella — May 6, 2011 @ 11:12 am
We stumbled over here coming from a different page and thought I might as well check things out. I like what I see so i am just following you. Look forward to looking over your web page repeatedly.
Comment by meble drewniane — May 8, 2011 @ 10:28 pm
Hello there, You have done an incredible job. I’ll definitely digg it and personally suggest to my friends. I am confident they’ll be benefited from this web site.
Comment by meble nowoczesne — May 10, 2011 @ 7:27 am
I appreciate, lead to I discovered exactly what I used to be looking for. You’ve ended my 4 day long hunt! God Bless you man. Have a nice day. Bye
Comment by Pogotowie komputerowe Warszawa — May 13, 2011 @ 6:58 pm
Together with every little thing which appears to be developing inside this particular subject matter, a significant percentage of perspectives are relatively stimulating. On the other hand, I appologize, but I can not subscribe to your entire suggestion, all be it exhilarating none the less. It seems to everyone that your commentary are actually not completely validated and in fact you are generally yourself not even totally convinced of your assertion. In any event I did appreciate reading through it.
Comment by Trykkeri Oslo — May 14, 2011 @ 6:56 pm
Thanks for another excellent post. Where else could anyone get that kind of info in such an ideal way of writing? I’ve a presentation next week, and I am on the look for such information.
Comment by Strony flash — May 16, 2011 @ 12:36 am
You’re blogging has really come on when I look back over previous posts. Actually I arrived here from a forum on an unrelated topic. Worth surfing sometimes. Thanks.
Comment by Destiny — May 18, 2011 @ 7:56 am
Thanks forwards this acquaintance. I’m anticipatory Tuesdays!
Comment by kredyty — May 20, 2011 @ 4:45 pm
This sounds somewhat breathtaking before me…can’t sweat it out this…thank you!
Comment by Pozyczki — May 24, 2011 @ 5:19 pm
I was looking for this the other day. i dont usually post in forums but i wanted to say thank you!
Comment by Watch Internet Tv — May 24, 2011 @ 7:18 pm
Its always good to learn tips like you share for blog posting. As I just started posting comments for blog and facing problem of lots of rejections. I think your suggestion would be helpful for me. I will let you know if its work for me too.”
Comment by Pa Collman — May 29, 2011 @ 9:47 am
oversize listing you’ve hold
Comment by Danilo Koslosky — June 8, 2011 @ 5:19 pm
Dude.. I am not much into reading, but somehow I got to read lots of articles on your blog. Its amazing how interesting it is for me to check out you really often.
Comment by Claudio Deslatte — June 9, 2011 @ 2:45 am
Aw, this was a really quality post. In theory I’d like to write like this too – taking time and real effort to make a good article… but what can I say… I procrastinate alot and never seem to get something done.
Comment by Antone Ledsinger — June 9, 2011 @ 5:38 am
Just thought i would comment and say neat design, did you code it yourself? Looks great.
Comment by Rozanne Nembhard — June 9, 2011 @ 7:14 am
Comfortably, the article post is during truthfulness a hottest on this subject well known subject matter. I agree with ones conclusions and often will desperately look ahead to your . Saying thanks a lot will not just be sufficient, for ones wonderful ability in your producing. I will immediately grab ones own feed to stay knowledgeable from any sort of update versions. get the job done and much success with yourbusiness results!
Comment by birthday quotes — June 10, 2011 @ 4:18 am
Excellent! Your blog has a ton comments. How did you get all of these readers to see your article I’m jealous! I’m still studying all about blogs on the net. I’m going to look around on your website to get a better understanding how to achieve success. Thank you!
Comment by Stephenie Minato — June 10, 2011 @ 4:22 am
I’d like to read everything that you know regarding this subject matter. You only have scratched the surface of your knowledge about this and that is apparent in the way you blog. Have you thought about devoting an entire website to ensure that people will not miss that which you must say?
Comment by filtered water — June 10, 2011 @ 10:05 pm
Some really helpful information in there. Thanks for any future updates.
Comment by Office Furniture Canberra — June 11, 2011 @ 7:24 am
wow – now that’s what i call a good article. keep up the work
Comment by Xrumer Profile — June 12, 2011 @ 12:04 pm
This is a really good weblog. I have been back several times in the last 7-day time period and wish to sign up for your own feed by utilizing Google but can not really learn how to get it done precisly. Are you aware of any sort associated with guides?
Comment by chi hair straighteners — June 13, 2011 @ 5:27 am
That’s a beneficial standpoint, but seriously isn’t produce any kind of sence in any way referring to that will mather. Virtually any way many thanks in addition to pondered try to reveal your own article in to delicius nevertheless it seems to be problems with your websites is it possible to i highly recommend you recheck them. thank you once more.
Comment by Wiccan Spells — June 13, 2011 @ 4:33 pm
Just wanted to give you a shout from the valley of the sun, great information. Much appreciated.
Comment by Eva — June 13, 2011 @ 4:52 pm
Word Count in Unix | Word Count Blog Great goods from you, man. I’ve understand your stuff previous to and you are just extremely wonderful. I actually like what you have acquired here, certainly like what you are saying and the way in which you say it. You make it enjoyable and you still care for to keep it wise. I can’t wait to read far more Word Count in Unix | Word Count Blog again from you. Thanks For Share .
Comment by review garmin nuvi — July 27, 2011 @ 1:11 am
Your post is short by taking the value of information and straight to the point. It has been a delight to go through. Thanks! To give you something back, i kindly left you a link to the greatest template i came across all time, this thing earned my so much by just doing almost nothing….. you should take a look!
Comment by Cathey Rymes — July 27, 2011 @ 8:11 pm
Thanks for the great article. Looking forward to the next one.
Comment by Benoit — July 28, 2011 @ 10:39 am