Sed question

Markus Schönhaber ubuntu-users at
Fri Sep 23 13:03:00 UTC 2011

23.09.2011 13:37, Oliver Marshall:

> FileVersion:     14.0.4756.1000
> And I want to remove everything before the 1, leaving;
> 14.0.4756.1000
> I thought that the following should do it but it doesn't appear to work. Any ideas what I should be using?
> sed "/^FileVersion: */!d; s///;q"
> (This is using SED for windows, but as far as I can see the syntax is the same).

$ echo "FileVersion:     14.0.4756.1000" | sed '/^FileVersion: */!d; s///;q'

(this is using sed on Lucid)

Some comments:
- Depending on the shell you use, the '!' might be treated specially if
not surrounded by single quotes and thus might not make it literally to
the sed command line.
- ' *' matches spaces, not, for example, TABs.


More information about the ubuntu-users mailing list