Skip to main content
The 2024 Developer Survey results are live! See the results

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.

4
  • 66
    sed -e 's/version=\(.+\)/\1/' input.txt this will still output the whole input.txt
    – Pablo
    Commented May 6, 2010 at 0:28
  • 3
    @Pablo, In your pattern you have to write \+ instead of +. And I dont understand why people use -e for just one sed command. Commented Nov 10, 2017 at 12:23
  • 1
    use sed -e -n 's/version=\(.+\)/\1/p' input.txt see: mikeplate.com/2012/05/09/…
    – awattar
    Commented Apr 10, 2018 at 9:43
  • 6
    I'd suggest using sed -E to use the so-called "modern" or "extended" regular expressions that look a lot closer to Perl/Java/JavaScript/Go/whatever flavors. (Compare to grep -E or egrep.) The default syntax has those strange escaping rules and is considered "obsolete". For more info on the differences between the two, run man 7 re_format.
    – AndrewF
    Commented Nov 28, 2018 at 3:51