Today (Saturday) We will make some minor tuning adjustments to MySQL.

You may experience 2 up to 10 seconds "glitch time" when we restart MySQL. We expect to make these adjustments around 1AM Eastern Daylight Saving Time (EDT) US.


length of the string


 
Thread Tools Search this Thread
# 1  
length of the string

Hi all,

pls help me in finding the length of the given string,

do we need to write a code seperately or is there any command??

pls help.
# 2  
Quite a few ways to do it.

Here's one way.

Code:
expr length "LENGTH"

gives you 6

-vino
# 3  
length=${#variable}
in ksh and bash.

echo "$variable" | wc -c
but will be 1 above as has newline feed (so -1)

length=`expr length "$variable"`but very depreciated
 

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
String with different length
vikus
let image that we have string: QQQQQQQ:ABCDE:FFFFFF:GGGGG in second field can be 0 or 5 characters if A exist i need set variable ex: VAR=yes if B exist i need set variable ex: VAR1=yes if C exist i need set variable ex: VAR2=yes etc ... if second field is empty no variable to set if...... Shell Programming and Scripting
4
Shell Programming and Scripting
Read a string with leading spaces and find the length of the string
dayamatrix
HI In my script, i am reading the input from the user and want to find the length of the string. The input may contain leading spaces. Right now, when leading spaces are there, they are not counted. Kindly help me My script is like below. I am using the ksh. #!/usr/bin/ksh echo...... UNIX for Dummies Questions & Answers
2
UNIX for Dummies Questions & Answers
read string, check string length and cut
ozzy80
Hello All, Plz help me with: I have a csv file with data separated by ',' and optionally enclosed by "". I want to check each of these values to see if they exceed the specified string length, and if they do I want to cut just that value to the max length allowed and keep the csv format as it...... Shell Programming and Scripting
9
Shell Programming and Scripting
sed problem - replacement string should be same length as matching string.
amangeles
Hi guys, I hope you can help me with my problem. I have a text file that contains lines like this: 78 ANGELO -809.05 79 ANGELO2 -5,000.06 I need to find all occurences of amounts that are negative and replace them with x's 78 ANGELO xxxxxxx 79...... Shell Programming and Scripting
4
Shell Programming and Scripting
length of string
dilipluhar
How one can measure the length of a string but not with the help of awk utility Can we write shell script for the same ?... UNIX for Dummies Questions & Answers
2
UNIX for Dummies Questions & Answers

Featured Tech Videos