get the specific variable of length

Posted on 2010-01-04
Last Modified: 2013-12-25
How to get the length from different size?
for example:-
aaa=expert exchange idea  
bbb=new Zealand

the result i wan to get is
aaa=expert exchange ide
bbb=new Zealan

I need the command

Thank you so much
Question by:ryanW
    LVL 84

    Accepted Solution

    aaa='expert exchange idea'
    bbb='new Zealand'
    echo aaa=$aaa
    echo bbb=$bbb

    Author Comment

    Thank you for ur help.. it is working...
    but i got a question need to ask u..
    is it possible to control the size that i wan to get..

    like... "AAA SSS CCC"

    i want to get 6 character
    so.. it will be "AAA SS"

    size of 11 will be "GGGG AAA XX"

    can u help  me?
    thank you

    LVL 84

    Expert Comment

    aaa="AAA SSS CCC"
    echo ${aaa:0:6}

    Author Comment

    yaya...i try myself already... can work also..
    thank you so  much... xie xie

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
    It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
    Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now