[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: regexp: anything but |



On Wed, Dec 09, 2009 at 07:46:04PM +0000, Chris Jackson wrote:
> lee wrote:
> 
> >On Wed, Dec 09, 2009 at 07:07:52PM +0000, Chris Jackson wrote:
> >>
> >>Note that from the shell this is in single quote marks to stop shell
> >>expansions. Doing it without those would be masochism ;)
> >
> >It already is:
> >
> >
> >lee@yun:~/tmp/chan$ cat channels.dvb | sed '/^[^|]*|[^|]*-[0-9]|/' | wc -l
> >sed: -e Ausdruck #1, Zeichen 21: Fehlender Befehl
> >0
> >lee@yun:~/tmp/chan$
> >
> >
> >(which means: "expression #1, character 21: missing command" --- and
> >it matches every line)
> >
> >But the idea behind your version is interesting :)
> 
> 
> Well, you need to give it a command, I just gave you the regex. And
> the default in sed is to print every line. Try:

Ah, I overlooked that! It seems to work!

It should have been obvious, but I rarely use sed because it's so
hard, but in this case, I thought I'd give it a try rather than
writing a C program to do it. Thanks!


Reply to: