Thread: wc anomaly
View Single Post

   
  #5 (permalink)  
Old 04-03-2008, 02:45 PM
Jeff Hyman
 
Posts: n/a
Default Re: wc anomaly

Bob Stockler typed (on Sat, Mar 29, 2008 at 03:53:42PM -0400):
| Jeff Hyman wrote (on Sat, Mar 29, 2008 at 03:16:23PM -0400):
|
| | # echo "abcde" > /tmp/foo
| | # wc -m /tmp/foo (-c flag gives same results)
| | 6 foo
| |
| | Am I going nuts, or is this a bug?
|
| You're going (or staying) nuts.
|
| | File 'foo' has 5 characters, not 6 ... and no blank lines or spaces.
| |
| | If this is the way it's supposed to be, then
| | how can one rely on its output except to remember
| | to subtract 1 ?
|
| If you execute:
|
| hd /tmp/foo
|
| you'll see there are 6 characters in it - "abcde" followed by "0a",
| the newline character.
|
| Bob

Guys,

I know about the -n \c flags for echo... but no where and no time
did I ever imagine what you so clearly explain above.

Where I typically use 'wc' is if I run a classified or to rent some
commercial space, or sell something, or hire someone. I use(d) the
'wc' command to determine the cost of the ad by the character count.
I never would have detected it except I tried it on one word.

Looks like I've been getting "Oa'ed" for some time.
Bobby... does this mean I'm "going" or "staying" nuts? :-)

- Jeff H
Reply With Quote