Cut

I have an html file.The entire script is in one line only. The
following is the script.

<table><tbody><tr><td class="r">Chapter
1: ................................................. </td></tr></
tbody></table><p Hare Krishna</p>

In the above script I want to delete the text

<table><tbody><tr><td class="r">Chapter
1: ................................................. </td></tr></
tbody></table>

where ........ represents variable content.

I have 100 files with names 1.htm to 100.htm

How can i do this using unix commands rather than selecting the text
and deleting.

Thanks
Santhosh
sant527 [ Di, 27 November 2007 10:34 ] [ ID #1879530 ]

Re: Cut

sant527 [at] gmail.com scrisse:

> ...

sed -i 's:<p Hare Krishna</p>::g' $_a_bunch_of_files

man sed

My two eurocent

PS No, I don't want dollars :D
mallin.shetland [ Di, 27 November 2007 10:44 ] [ ID #1879531 ]

Re: Cut

Does it say "<p Hare Krishna</p> " in all files?
thomasriise [ Di, 27 November 2007 10:44 ] [ ID #1879532 ]

Re: Cut

for file in `ls *.html 2>/dev/null`
do
cat $file | sed 's/\(.*\)\(<p Hare Krishna<\/p>\)\(.*\)/\2/'g >
tempfile
mv tempfile $file
done
thomasriise [ Di, 27 November 2007 11:00 ] [ ID #1879533 ]

Re: Cut

On 27 Nov., 11:00, thomasriise <thomasri... [at] gmail.com> wrote:
> for file in `ls *.html 2>/dev/null`

for file in *.html

> do
> cat $file | sed 's/\(.*\)\(<p Hare Krishna<\/p>\)\(.*\)/\2/'g >tempfile

sed 's/.../.../g' "$file" >tempfile &&

> mv tempfile $file

mv tempfile "$file"

> done

Janis
Janis Papanagnou [ Di, 27 November 2007 11:37 ] [ ID #1879535 ]

Re: Cut

> sed 's/.../.../g' "$file" >tempfile &&

- point taken
thomasriise [ Di, 27 November 2007 11:43 ] [ ID #1879536 ]
Linux » comp.unix.shell » Cut

Vorheriges Thema: Top 10 posters comp.unix.shell
Nächstes Thema: Acrobat reader and find