The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Counting the number of occurances of all characters (a-z) in a string rsendhilmani Shell Programming and Scripting 5 08-05-2008 01:10 PM
handling maximum number characters in an input file chrysSty UNIX and Linux Applications 1 05-12-2008 11:19 AM
How to ignore characters and print only number using unix? cdfd123 UNIX for Dummies Questions & Answers 5 08-03-2007 04:47 AM
number of escape characters? Sebarry Shell Programming and Scripting 0 06-22-2006 05:23 PM
What is the Maximum number of characters that i can store in a variable? pcshan UNIX for Advanced & Expert Users 9 08-11-2004 06:25 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-08-2008
metalwarrior metalwarrior is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 16
wc -c (number of characters)

for some reason word count always counts one extra character.
for example,
echo 11 | wc -c
counts 3 characters instead of 2
anyone know how to get the exact number of characters?
  #2 (permalink)  
Old 02-08-2008
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
Quote:
Originally Posted by metalwarrior View Post
for some reason word count always counts one extra character.
for example,
echo 11 | wc -c
counts 3 characters instead of 2
anyone know how to get the exact number of characters?
There is also the newline character which you dont see.


Code:
[/tmp]$ echo "11" | od -a
0000000   1   1  nl
0000003
[/tmp]$ echo -n "11" | od -a
0000000   1   1
0000002
[/tmp]$ echo -n "11" | wc -c
2

Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:52 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0