That replaces all the lines that start with #target, not just the first one.

-----Original Message-----
From: Linux on 390 Port [mailto:[EMAIL PROTECTED] Behalf Of
Darren Zamrykut
Sent: Wednesday, October 25, 2006 12:47 PM
To: [email protected]
Subject: Re: use sed or awk or ?


This should replace the first target:

sed -e 's/^ #target\(.*\)/another string/' file > newfile

Darren



On Wednesday 25 October 2006 14:57, Romanowski, John (OFT) wrote:
> I want to find the first comment line that begins with a target string
> in column 1 (#target) and replace only that first target line with
> another string.
> There are multiple lines that begin with #target.
>
> I've struck out with sed (not that I know sed).
>
> Any quick hints on a sed or awk or ?? sequence that does that?


----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390

Reply via email to