Re: regexp: anything but |
lee wrote:
> On Wed, Dec 09, 2009 at 06:07:34PM +0000, Chris Jackson wrote:
>> To match anything except |, use:
>>
>> [^|]
>
> Thanks! That's nice, but the pattern '\^.*\|[^\|]-[0-9]\|' still
> matches all lines ... and I don't see why/how it could to that
> ... Hmm. Here's an example line:
>
>
> TV|VOX-1|167(2)|136(ger),|71|12060|1089|SAstra-1H|12187|27500|h|34|-1|-1|-1|-1|-1|-1|-1|2120|||1|
Your problem is that regular expressions try to match _as much as
possible_ and there are more instances of -1 etc. further back in the
lines. '.*' matches any character and thus everything up to the last
instance of '-[0-9]'.
What you'd want is probably
sed '/[^|]-[0-9]/d' channels.dvb
which will delete all lines with a '-[0-9]' that is not directly
preceded by a |
--
Johannes
Three nations have not officially adopted the International System
of Units as their primary or sole system of measurement: Burma,
Liberia, and the United States.
http://en.wikipedia.org/wiki/Si_units
Reply to: