home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!europa.asd.contel.com!emory!swrinde!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!eng.ufl.edu!spp
- From: spp@crane.cis.ufl.edu (Stephen P. Potter)
- Subject: Re: counting spaces
- Message-ID: <1993Jan8.164058.2454@eng.ufl.edu>
- Sender: news@eng.ufl.edu (Usenet Diskhog System)
- Organization: Univ. of Florida CIS Dept.
- References: <1993Jan7.191409.25394@netnews.whoi.edu>
- Date: Fri, 8 Jan 93 16:40:58 GMT
- Lines: 19
-
- In article <1993Jan7.191409.25394@netnews.whoi.edu> eklein@whsun1.wh.whoi.edu writes:
- >
- >How do you count the spaces in a text file using Unix commands? Sounds simple
- >dosen't it.
-
-
- This can be taken many ways. I personally decided to take it literally. You
- want to know how many times the space bar was pressed in the file. IE, I do
- not count <tab> as being eight spaces or anything like that.
-
- tr '\012' "#" <$infile | tr " " '\012' | wc -l
-
-
- Steve
- --
- cccc i ssss University of Florida Computer and Information Sciences
- c s Unix Consulting Staff (904) 392-1183 E309A
- c i ssss Email: spp@cis.ufl.edu, u4930any@elm.circa.ufl.edu
- c i s PRISONER@ufcc.ufl.edu, Bitnet: PRISONER@ufcc cccc i ssss
-