*BSD News Article 69883


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!news.hawaii.edu!ames!news.larc.nasa.gov!lerc.nasa.gov!magnus.acs.ohio-state.edu!math.ohio-state.edu!usc!hookup!usenet.eel.ufl.edu!bofh.dot!tank.news.pipex.net!pipex!dispatch.news.demon.net!demon!awfulhak.demon.co.uk!awfulhak.demon.co.uk!not-for-mail
From: brian@awfulhak.demon.co.uk (Brian Somers)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: [S]: Script
Date: 31 May 1996 22:59:43 +0100
Organization: Coverform Ltd.
Lines: 38
Message-ID: <4onq4f$h2@anorak.coverform.lan>
References: <xorMtMD4F99aRz1@borki.zug.use.ch>
NNTP-Posting-Host: anorak.coverform.lan
X-NNTP-Posting-Host: awfulhak.demon.co.uk

Reto Burkhalter (BORKI@zug.use.ch) wrote:
: Hy Everyone... 
:  
:  
: I'm looling for a shell script or command line syntax in 
: order to delete lines in a file with a specific content. 
: I want to delete member entries in a database without having 
: to invoke an editor. 
:  
: e.g. database file 
:  
: foo xxyy 
: bar yyzz 
: sec zzaa 
:  
:  
: %script <file> <entry> ; %script database foo -> deletes the 
: first entry (line) in the database. 
:  
: Who can help me?? 
:  
:  
: Reto 
:  

how about

    sed "/$2/d" $1 >/tmp/$$
    mv /tmp/$$ $1

specifically

    sed /foo/d database >/tmp/$$
    mv /tmp/$$ database

--
Brian <brian@awfulhak.demon.co.uk>
Don't _EVER_ lose your sense of humour....