Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Dec 2002 13:41:37 +0000
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        questions@FreeBSD.ORG
Subject:   Re: is there a delete/backspace command on Freebsd ?
Message-ID:  <20021218134137.GA74300@happy-idiot-talk.infracaninophi>
In-Reply-To: <007101c2a688$ccc06880$dc96eed5@ymmaslak>
References:  <007101c2a688$ccc06880$dc96eed5@ymmaslak>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021218134137.GA74300>