sed s only on first matching line?



This seems like it sould be a faq, but i can't find an answer. Is
there a reasonably simple way to do a

sed 's/foo/bar/'

such that it only operates on the first matching line it finds and
then quits.

So the file:

bob
fred
foo
joe
jim
foo

would become

bob
fred
bar
joe
jim
foo


???


Thanks for any pointers.

.



Relevant Pages

  • Re: Random numbers (with preference)
    ... Let's say your candidates are Bob, Joe, Bill, and Jim. ...
    (comp.lang.basic.visual.misc)
  • Harris Poll voters list
    ... Bob Casciola ... Joe Crowley ... John Mallory ... Jim Vruggink ...
    (rec.sport.football.college)
  • OTP: More sunbeams
    ... Bob> at 24 inches. ... Jim> Code could be different out there. ... Joe> Don't sunbeams count for something, ... All around us, on satelite radar, is sun, ...
    (alt.support.arthritis)
  • Re: NFS Security Question
    ... >>netgroup (which contains hosts for which the root password is only ... >>he frequently uses that machine because of the software 'bob' has ... > system-wide default login enviroment and a CWD of '/' on 'foo'. ... varies as machines are replaced etc.), on a total of 300 to 400 ...
    (Focus-SUN)
  • Re: generic INTERFACE and name clash
    ... program is valid as JOE is never referred and thus this restriction ... other than generic interfaces or ... may have the same identifier only if the identifier ... INTERFACE FOO ...
    (comp.lang.fortran)