![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| 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 !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| length of string | silas.john | UNIX for Dummies Questions & Answers | 8 | 02-06-2008 04:22 PM |
| read string, check string length and cut | ozzy80 | Shell Programming and Scripting | 9 | 03-21-2007 02:56 PM |
| sed problem - replacement string should be same length as matching string. | amangeles | Shell Programming and Scripting | 4 | 01-11-2006 03:11 AM |
| String length in ksh | ssgrpid | Shell Programming and Scripting | 4 | 08-03-2005 10:39 AM |
| length of string | dilipluhar | UNIX for Dummies Questions & Answers | 2 | 06-28-2001 07:35 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to count the string length
Please can anyone tell me, how to count the string length
|
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
One way is to assign it to a variable. And then do ${#variable}. The other would be to traverse through the string and keep a count.
|
|
#3
|
||||
|
||||
|
Another is using "wc" though I think it also couts "return char"...
For instance, in AIX with bash: echo helo | wc -m returns 5 echo -e "helo\c" | wc -m returns 4 |
||||
| Google The UNIX and Linux Forums |