Extract
Hi all
I want to extract text between
the patterns
<p class="h">
.....
.....
.....
<p class="t">SYNONYMS</p>
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
sant527 [at] gmail.com wrote:
> Hi all
>
> I want to extract text between
>
> the patterns
>
> <p class="h">
> ....
> ....
> ....
> <p class="t">SYNONYMS</p>
>
> 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 '
/<p class=\"t\">SYNONYMS<\/p>/ { found = 0 }
found
/<p class=\"h\">/ { found = 1 }
' file
To print everything except the selected lines:
awk '
/<p class=\"t\">SYNONYMS<\/p>/ { found = 0 }
!found
/<p class=\"h\">/ { found = 1 }
' file
Regards,
Ed.
Re: Extract
How to execute this code on files. Where should I give the file name.
On Oct 26, 7:13 pm, Ed Morton <mor... [at] lsupcaemnt.com> wrote:
> sant... [at] gmail.com wrote:
> > Hi all
>
> > I want to extract text between
>
> > the patterns
>
> > <p class="h">
> > ....
> > ....
> > ....
> > <p class="t">SYNONYMS</p>
>
> > 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 '
> /<p class=\"t\">SYNONYMS<\/p>/ { found = 0 }
> found
> /<p class=\"h\">/ { found = 1 }
> ' file
>
> To print everything except the selected lines:
>
> awk '
> /<p class=\"t\">SYNONYMS<\/p>/ { found = 0 }
> !found
> /<p class=\"h\">/ { found = 1 }
> ' file
>
> Regards,
>
> Ed.