Re: Append only first instance with sed?
From: Kenny McCormack (gazelle_at_yin.interaccess.com)
Date: 07/01/04
- Next message: PJ: "Re: removing lines from a file"
- Previous message: Tony: "adding users from a file"
- In reply to: Alan Connor: "Re: Append only first instance with sed?"
- Next in thread: Alan Connor: "Re: Append only first instance with sed?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 30 Jun 2004 22:48:16 GMT
In article <aTFEc.452$R36.60@newsread2.news.pas.earthlink.net>,
Alan Connor <xxxx@yyy.zzz> wrote:
>On Wed, 30 Jun 2004 20:24:38 GMT, Kenny McCormack <gazelle@yin.interaccess.com> wrote:
>>
>>
>> In article <slrnce5n30.180.stephane.chazelas@spam.is.invalid>,
>> Stephane CHAZELAS <this.address@is.invalid> wrote:
>>>2004-06-30, 10:24(-05), glitch@mlh.net:
>>>> I'm trying to do an append with sed. My problem is that the pattern
>>>> that I'm matching occurs more than once in the file. I only want to
>>>> append the first time the pattern is found. Here is what I have:
>>>>
>>>> sed -e "1,/^Listen/a\\
>>>> Listen $WWWIP:443
>>>> " </usr/local/apache/conf/ssl.conf >/tmp/ssl.conf.$$
>>>[...]
>>>
>>>Use awk instead:
>>
>> This is the best advice I've seen posted in comp.unix.shell in quite some
>> time. Most of the time, if you try to use sed to solve a problem, all
>> you're doing is demonstrating to the world that you are into pain.
>>
>
>Says someone who doesn't know sed. For someone who didn't know awk,
>using IT would be a pain.
>
>DUH
>
>In this case, the OP *obviously* doesn't know either one of them.
Thanks for making my point. The fact is that a lot of newbies don't really
know either, but get involved in using sed, because it is decepively simple
to use (for very simple tasks).
I.e., the only excuse for using sed for complex tasks is because one
already knows it well (in which case, there is no hope for you...)
- Next message: PJ: "Re: removing lines from a file"
- Previous message: Tony: "adding users from a file"
- In reply to: Alan Connor: "Re: Append only first instance with sed?"
- Next in thread: Alan Connor: "Re: Append only first instance with sed?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|