wc -c


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers wc -c
# 1  
Old 04-15-2004
wc -c

Hi,


When I use wc -c :

echo "word" |wc -c
5

The number is number of letters +1

I don't understand... Where is the probleme?
I am on AIX but on HP, it the same probleme.
# 2  
Old 04-15-2004
.....

Last edited by druuna; 05-21-2009 at 10:12 AM..
druuna
# 3  
Old 04-15-2004
wc is counting the newline character...

$ echo "word" | od -c
0000000 w o r d \n
0000005
$ printf "word" | od -c
0000000 w o r d
0000004

Perhaps use expr to find the word length..

$ expr length "word"
4
# 4  
Old 04-15-2004
It is strange.... Smilie

Thank you for your answer
Smilie
# 5  
Old 04-15-2004
there was a discussions about this mabey 1 or 2 months ago w/ Perderabo posting in that thread. I think i might have also posted in that thread. but it covered it pretty good.
# 6  
Old 04-16-2004
Optimus, Have you a link to this discution for me? It's could be interesting....
I can't find it....


Thanks
 
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question