Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 15
    It's treating your "variables" as strings because that's all sed does - string manipulation. It has no concept of "integer." Commented Apr 20, 2012 at 16:10
  • 4
    I'm very curious why you want to use sed to do math Commented Apr 21, 2012 at 13:43
  • I just thought it could easily cast variables, didn't realize was so complex! Commented Apr 22, 2012 at 16:56
  • 1
    I'm a little late, but vim users have maybe done math in a search and replace command before and since sed is very similar to vim search and replace, one would assume you could do the same type of stuff with it @DavidOneill Commented Dec 27, 2019 at 18:04