On Saturday 21 Jun 2008, Agnello George wrote:
> > > after this given pattern
> > > */trademark UNIX/ *
> > > if exist then
> > > i want to delete the block-pattern
> > > /*is The Open Group*\n*an industry standards/*
> >
> > What exactly do you want to delete? The next two lines? The
> > specific text ...Open group...industry standard...? Up to some
> > other pattern?
>
> Yes i want to delete a specific text after a certain pattern is
> present , let me just re-explain, Suppose i have a given text file
> with the following content
> **
> *the owner of the*
> *trademark UNIX*
> *is The Open Group*
> *an industry standards*
> *consortium*
>
> then , if only /*trademark UNIX*/ is present then delete the the
> give specific text /*is The Open Group*\n*an industry standards*/
>
> the end result of the file should look like this
> **
> *the owner of the*
> *trademark UNIX*
> *consortium*
>
> the pattern /*trademark UNIX/* should not be edited/deleted
In Perl, something like this would do it:
perl -pi -e 'BEGIN{undef $/;} \
s/ALINE\nANOTHERLINE\nYETANOTHERLINE/ALINE/s;' /path/to/file
Add a g after the /s if you want to handle multiple matches. Add more
s/.../.../gs; constructs if you want to handle multiple patterns.
Should be possible in both sed and awk too, but I'm too lazy to read the
manuals right now.
Regards,
-- Raju
--
Raj Mathur [EMAIL PROTECTED] http://kandalaya.org/
GPG: 78D4 FC67 367F 40E2 0DD5 0FEF C968 D0EF CC68 D17F
PsyTrance & Chill: http://schizoid.in/ || It is the mind that moves
--
http://mm.glug-bom.org/mailman/listinfo/linuxers