The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

shell script: remove everything behind .'s

Discussion in 'General Discussion' started by laborspy, Apr 9, 2004.

  1. laborspy

    laborspy Well-Known Member

    Joined:
    Feb 7, 2004
    Messages:
    94
    Likes Received:
    0
    Trophy Points:
    6
    Does anyone know how to remove everything and including the .'s in a shell script. Right now I can remove the .'s but I don't know how to delete the other numbers.

    Val = `echo $1 | sed "s/\.//g"`
     
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    If you mean that you want to remove everything after the dot, then, if the regex follows the perl usage, the following should work:

    Code:
    Val = `echo $1 | sed "s/\..*//g"`
     
Loading...

Share This Page