Extract

Extract

am 26.10.2007 12:59:17 von sant527

Hi all

I want to extract text between

the patterns


.....
.....
.....

SYNONYMS



And also how to delete the text between the above two patterns.

I am having 700 files.

How to use the sed command for this.

Santhosh

Re: Extract

am 26.10.2007 16:13:46 von Ed Morton

sant527@gmail.com wrote:
> Hi all
>
> I want to extract text between
>
> the patterns
>
>


> ....
> ....
> ....
>

SYNONYMS


>
> And also how to delete the text between the above two patterns.
>
> I am having 700 files.
>
> How to use the sed command for this.
>
> Santhosh
>

To print the selected lines:

awk '
/

SYNONYMS<\/p>/ { found = 0 }
found
/

/ { found = 1 }
' file

To print everything except the selected lines:

awk '
/

SYNONYMS<\/p>/ { found = 0 }
!found
/

/ { found = 1 }
' file

Regards,

Ed.

Re: Extract

am 30.10.2007 07:23:46 von sant527

How to execute this code on files. Where should I give the file name.


On Oct 26, 7:13 pm, Ed Morton wrote:
> sant...@gmail.com wrote:
> > Hi all
>
> > I want to extract text between
>
> > the patterns
>
> >


> > ....
> > ....
> > ....
> >

SYNONYMS


>
> > And also how to delete the text between the above two patterns.
>
> > I am having 700 files.
>
> > How to use the sed command for this.
>
> > Santhosh
How to use these commands. I am new to awk

Should I write then i a file and then run the file. I have done that
but it shows nothing.

Can you guide how to use them on my files.



>
> To print the selected lines:
>
> awk '
> /

SYNONYMS<\/p>/ { found = 0 }
> found
> /

/ { found = 1 }
> ' file
>
> To print everything except the selected lines:
>
> awk '
> /

SYNONYMS<\/p>/ { found = 0 }
> !found
> /

/ { found = 1 }
> ' file
>
> Regards,
>
> Ed.