Re: Extract Text with "sed"



On Tue, 29 Jan 2008 00:08:15 -0800 (PST), Meendar <meendar@xxxxxxxxx> wrote:
Hi,

I am having a text generated from version output of an executable as

$ myprogram -v
Version: Myprogram/1.2.1 - Centos
Built: Aug 8 2007 13:05:44


I need to extract 1.2.1 from the above output, however i used sed like

$ myprogram -v | sed -e '/s/Myprogram\ /(*) ^-

This doesn't work.

That's because the sed expression is either misformatted by the program
you used to post this message or just incomplete, or both.

$ ( echo 'Version: Myprogram/1.2.1 - Centos' ; \
echo foo ) | \
sed -n -e '1s/.*\/\(.*\) - .*/\1/p'
1.2.1

.



Relevant Pages

  • Extract Text with "sed"
    ... $ myprogram -v ... Version: Myprogram/1.2.1 - Centos ... Built: Aug 8 2007 13:05:44 ... I need to extract 1.2.1 from the above output, ...
    (comp.unix.programmer)
  • Re: Extract Text with "sed"
    ... Please don't top-post. ... Version: Myprogram/1.2.1 - Centos ... Built: Aug 8 2007 13:05:44 ... Just replace the myprogram with httpd and please answer me. ...
    (comp.unix.programmer)
  • Re: Extract Text with "sed"
    ... Just replace the myprogram with httpd and please answer me. ... That's because the sed expression is either misformatted by the program ...
    (comp.unix.programmer)