From: pk on
Loki Harfagr wrote:

>> sed -f filename list_raw > list
>>
>> but it results in
>>
>> sed: file filename line 21: Unterminated `s'
>> sed -n '/^New/p'
>> s/^New /!d
>>
>> Have another beer, then try to be helpful,
>
> in case your problem comes from the '!' try this workaround:
> $ sed -n '/^New/p' file
>
> or maybe try it the funny way:
> $ sed '/^[^N][^e][^w]/d' file

This is slightly different, as it will not delete things like /^Med/ or
/^Nxx/ which the OP probably wants to delete.

From: Janis Papanagnou on
Sidney Lambe wrote:
> On comp.unix.shell, Janis Papanagnou
> <janis_papanagnou(a)hotmail.com> wrote: [delete]
>
>>>> or disable history expansion (which, however, I don't know
>>>> how is done with a C shell).
>>> Better yet, us bash, like almost everyone else.
>> Hardly "almost everyone".
>
> The overwhelming majority, unix or linux, in my experience.
> It's the default shell on most linux distros and at least
> some of the unix distros.

True for Linux. But you won't believe it; there's still a lot
commercial Unixes out there with Kornshell as default and that
don't have bash installed and the admins even not allowed to
install that bash beast.

>
> I think you hang out with more geeks than ordinary users :-)

Probably :-)

Though the geeks of my kind are typically called Dinosaurs, so
letting the term Geeks available free for the Linux users who
continue the crusade of Unix users against the pest and some such.

Janis

>
>> Better yet, use any modern POSIX shell. Anyway. A warning about
>> C shell would certainly be appropriate; @OP: see standard
>> lecture http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/
>
> Sure is easier to use bash, which is a good as any of the other
> POSIX shells and you are more likely to get help or be able
> to give it.
>
>>> I don't see why anyone bothers trying to help people using C
>>> shells. Their choice of shells clearly establishes their lack
>>> of intelligence and/or education.
>> That has rarely to do with intelligence in the first place;
>> with newbies it's most probably just ignorance. If you don't
>> know better you cannot make a better decision. Nothing that
>> can't be fixed.
>
> Good way to look at it.
>
> Sid
>
>
>
From: Loki Harfagr on
Sun, 28 Mar 2010 11:42:40 +0100, pk did cat :

> Loki Harfagr wrote:
>
>>> sed -f filename list_raw > list
>>>
>>> but it results in
>>>
>>> sed: file filename line 21: Unterminated `s'
>>> sed -n '/^New/p'
>>> s/^New /!d
>>>
>>> Have another beer, then try to be helpful,
>>
>> in case your problem comes from the '!' try this workaround: $ sed -n
>> '/^New/p' file
>>
>> or maybe try it the funny way:
>> $ sed '/^[^N][^e][^w]/d' file
>
> This is slightly different, as it will not delete things like /^Med/ or
> /^Nxx/ which the OP probably wants to delete.

Yup, that's right, this should then do, steer crazy but working ;-)
$ <file sed '/^..[^w]/d' | sed '/^.[^e]./d' | sed '/^[^N]../d'
From: pk on
Loki Harfagr wrote:

> Sun, 28 Mar 2010 11:42:40 +0100, pk did cat :
>
>> Loki Harfagr wrote:
>>
>>>> sed -f filename list_raw > list
>>>>
>>>> but it results in
>>>>
>>>> sed: file filename line 21: Unterminated `s'
>>>> sed -n '/^New/p'
>>>> s/^New /!d
>>>>
>>>> Have another beer, then try to be helpful,
>>>
>>> in case your problem comes from the '!' try this workaround: $ sed -n
>>> '/^New/p' file
>>>
>>> or maybe try it the funny way:
>>> $ sed '/^[^N][^e][^w]/d' file
>>
>> This is slightly different, as it will not delete things like /^Med/ or
>> /^Nxx/ which the OP probably wants to delete.
>
> Yup, that's right, this should then do, steer crazy but working ;-)
> $ <file sed '/^..[^w]/d' | sed '/^.[^e]./d' | sed '/^[^N]../d'

Not yet :-)

You also have to consider lines *shorter* than three characters, which have
to be deleted as well as there's obviously no way they can match /^New/:

$ <file sed '/^..[^w]/d' | sed '/^.[^e]./d' | sed '/^[^N]../d' | \
sed '/^.\{0,2\}$/d'

Removing some redundancy and putting everything in a single program, we have

$ <file sed '/^..[^w]/d;/^.[^e]/d; /^[^N]/d; /^.\{0,2\}$/d'

Seriosuly, use /^New/! and be happy :-)
From: Loki Harfagr on
Sun, 28 Mar 2010 16:34:37 +0100, pk did cat :

> Loki Harfagr wrote:
>
>> Sun, 28 Mar 2010 11:42:40 +0100, pk did cat :
>>
>>> Loki Harfagr wrote:
>>>
>>>>> sed -f filename list_raw > list
>>>>>
>>>>> but it results in
>>>>>
>>>>> sed: file filename line 21: Unterminated `s'
>>>>> sed -n '/^New/p'
>>>>> s/^New /!d
>>>>>
>>>>> Have another beer, then try to be helpful,
>>>>
>>>> in case your problem comes from the '!' try this workaround: $ sed -n
>>>> '/^New/p' file
>>>>
>>>> or maybe try it the funny way:
>>>> $ sed '/^[^N][^e][^w]/d' file
>>>
>>> This is slightly different, as it will not delete things like /^Med/
>>> or /^Nxx/ which the OP probably wants to delete.
>>
>> Yup, that's right, this should then do, steer crazy but working ;-) $
>> <file sed '/^..[^w]/d' | sed '/^.[^e]./d' | sed '/^[^N]../d'
>
> Not yet :-)
>
> You also have to consider lines *shorter* than three characters, which
> have to be deleted as well as there's obviously no way they can match
> /^New/:

Oh! oops, er... yes! that's a really good black sunday for me !-D)

>
> $ <file sed '/^..[^w]/d' | sed '/^.[^e]./d' | sed '/^[^N]../d' | \ sed
> '/^.\{0,2\}$/d'
>
> Removing some redundancy and putting everything in a single program, we
> have
>
> $ <file sed '/^..[^w]/d;/^.[^e]/d; /^[^N]/d; /^.\{0,2\}$/d'
>
> Seriosuly, use /^New/! and be happy :-)

Oh well, yes, I wouldn't use the last posts I made, except " sed -n '/^New /p' "
but that was only in case the OP was really cornered to have and use ludicrous
extents ,-)