#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Posts
    46
    Rep Power
    11

    Lightbulb KSH Scripting Question - Splitting String


    How do I split a string in KSH?
    For instance I have
    1.2.3

    and I want to split it out based on the period.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    121
    Rep Power
    11
    Try this:

    x="1.2.3"
    echo first = ${x%%.*} second = ${x#+([!.]).}
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jul 2004
    Location
    Middle Europa
    Posts
    1,200
    Rep Power
    14
    not clear what you want...
    to split
    echo "1.2.3" | sed 's/\./ /g'

IMN logo majestic logo threadwatch logo seochat tools logo