On Wed, Nov 13, 2013 at 10:32:16AM +0200, Martin Storsjö wrote:
> On Tue, 12 Nov 2013, Diego Biurrun wrote:
> >On Tue, Nov 12, 2013 at 11:11:52PM +0200, Martin Storsjö wrote:
> >>On Tue, 12 Nov 2013, Diego Biurrun wrote:
> >>>On Tue, Nov 12, 2013 at 06:03:06PM +0000, Derek Buitenhuis wrote:
> >>>>On 11/12/2013 10:42 AM, Martin Storsjö wrote:
> >>>>>This uses grep -o, which isn't a posix grep option, but is available
> >>>>>on both OS X, gnu and msys (which uses gnu grep). Suggestions on
> >>>>>a neater way to do the regexp matching are welcome.
> >>>>
> >>>>sed?
> >>>
> >>>Yes, something along the lines of
> >>>
> >>>diego@nibbler:~$ echo "Microsoft C++ Compiler 18.00.88" | sed 's/Microsoft 
> >>>C++ Compiler \(..\).*/\1/'
> >>>18
> >>>
> >>>could work, of course w/o the made-up pattern I just came up with.
> >>
> >>Yeah, although this requires hardcoding the preceding pattern (which
> >>is different across the versions we support right now). The
> >>differences aren't all that huge so it could be manageable, but if
> >>there's a way to do it without it I'd prefer that.
> >
> >'s/Microsoft.*Optimizing Compiler Version \(..\)/\1/'
> >
> >That should work across all the compiler strings I see on FATE and be
> >reasonably robust.
> 
> I'd prefer something more like this:
> 
> 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/'
> 
> This avoids specifying too much of the actual preceding string,
> requires a trailing dot and requires the chars to be digits.
> 
> The bigger question is how to know if it didn't match at all though,
> which grep -o took care of nicely.

-n

echo "Microsoft (R) C/C++ Optimizing Compiler Version 18.00.60610.1 for ARM" | 
sed -n 's/.*Version \([[:digit:]]\{2,2\}\)\..*/\1/p'

This is slightly more restrictive in only accepting exactly two digits.
Use whatever you deem most appropriate.

Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to