# [EMAIL PROTECTED] / 2002-12-18 13:41:37 +0000:
> On Wed, Dec 18, 2002 at 01:29:59PM +0200, Malik Bülent wrote:
> 
> >  I have a file.
> >  How can I backspace 5 character that start with expressions(the expression
> >  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:(?<=/aaa).{5}::g' filename


    sed -i.bak 's:/aaa.::g' filename
    sed -Ei.bak 's:(/aaa).{5}:\\1:g' filename

    would probably be quite faster (neither tested)

-- 
If you cc me or remove the list(s) completely I'll most likely ignore
your message.    see http://www.eyrie.org./~eagle/faqs/questions.html

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message

Reply via email to