From owner-freebsd-questions Wed Dec 18 5:41:55 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0B26A37B401 for ; Wed, 18 Dec 2002 05:41:54 -0800 (PST) Received: from smtp.infracaninophile.co.uk (ns0.infracaninophile.co.uk [81.2.69.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7714F43ED1 for ; Wed, 18 Dec 2002 05:41:52 -0800 (PST) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [IPv6:::1]) by smtp.infracaninophile.co.uk (8.12.6/8.12.6) with ESMTP id gBIDfgQn074845 for ; Wed, 18 Dec 2002 13:41:42 GMT (envelope-from matthew@happy-idiot-talk.infracaninophile.co.uk) Received: (from matthew@localhost) by happy-idiot-talk.infracaninophile.co.uk (8.12.6/8.12.6/Submit) id gBIDfbqt074844 for questions@FreeBSD.ORG; Wed, 18 Dec 2002 13:41:37 GMT Date: Wed, 18 Dec 2002 13:41:37 +0000 From: Matthew Seaman To: questions@FreeBSD.ORG Subject: Re: is there a delete/backspace command on Freebsd ? Message-ID: <20021218134137.GA74300@happy-idiot-talk.infracaninophi> Mail-Followup-To: Matthew Seaman , questions@FreeBSD.ORG References: <007101c2a688$ccc06880$dc96eed5@ymmaslak> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <007101c2a688$ccc06880$dc96eed5@ymmaslak> User-Agent: Mutt/1.5.1i X-Spam-Status: No, hits=-2.2 required=5.0 tests=IN_REP_TO,REFERENCES,SPAM_PHRASE_00_01,USER_AGENT, USER_AGENT_MUTT version=2.43 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, Dec 18, 2002 at 01:29:59PM +0200, Malik B=FClent wrote: > I have a file. > How can I backspace 5 character that start with expressions(the expressi= on > starts /aaa) in a file ? > for example my file; > " /aaa/yy/ > /aaa/.. > " If you mean "how can I delete each instance of 5 characters starting with /aaa from a file", then something like this should do it: perl -pi.bak -e 's:/aaa.::g;' filename which deletes the /aaa and the following (fifth) character. If you mean to delete the 5 characters immediately *following* /aaa then: perl -pi.bak -e 's:(?<=3D/aaa).{5}::g' filename Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message