Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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:
    156
    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,460
    Likes Received:
    21
    Trophy Points:
    463
    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"`
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice