Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!wuarchive!udel!princeton!phoenix.Princeton.EDU!pfalstad From: pfalstad@phoenix.Princeton.EDU (Paul John Falstad) Newsgroups: comp.unix.shell Subject: Re: sed help Message-ID: <4478@idunno.Princeton.EDU> Date: 4 Dec 90 18:09:08 GMT References: <99.2757f296@vax1.cc.lehigh.edu> Sender: news@idunno.Princeton.EDU Organization: Princeton University, Princeton, New Jersey Lines: 16 In article <99.2757f296@vax1.cc.lehigh.edu> lubkt@vax1.cc.lehigh.edu writes: >A question on sed: > I want to replace a string xyz:KJSDKJSDJS: by xyz:: in a >password file. The string "KJSDKJSDJS" is arbitrary. So I try: > sed -e 's/xyz:\??:/xyz::' $passwd Try: sed '/^xyz:/s/:[^:]*:/::/' $passwd -- From somewhere in front, you hear a repulsive squelching mumble, as if a chattering orangutan has suddenly had its mouth crammed full of earthworms. "You're invading my personal space!" shrieks the travel agent, rearing back from you like an offended snake. She is probably from California.