Re: sed on html pages

Silvio Siefke <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
Hello,

On Sun, 2 Mar 2014 15:42:55 +0100 Sven Guckes
<[email protected]> wrote:

> yes, you can put all commands into a file
> and tell sed to run them from there:
> 
>     sed -f file

Ah okay i has put then after after with ; But i think now i understand
what mean Ron in the mail before. There come some error message. 
 
> this would probably change your script to this:
> 
>   $ cat sedcommands
>   s|<[/]\?div[^>]*>||g
>   s!id="ext"!!g
>   s!id="vid"!!g
>   s!&nbsp;!!g

Ah okay so i will try.
 
>   $ cat silvioscript
>   #!/bin/bash
>   find -type f -name '*html' -exec tidy -m -config ~/.config/tidy/com
> {} \; find -type f -name '*html' -exec sed -i -f sedcommands {} \;
> 
> but here you use the same find command twice to find
> all the html files yet again for the next command.
> you only need to find all html files only once,
> then execute the tidy+sed commands on these in one go.

Yes should run over all html files. 

> if your shell is zsh then finding the html files
> is as easy as using this pattern: **/*html
> so you can put the finding of files
> outside the script.
> 
> and when you put tidy+sed into on script
> then it should all boil down to this:
> 
>   script **/*html

Ah yes that i has do. I put all in a bash script and after website build
run tidy and then sed. 

> so much for ideas. :)

Thank you so much for help and Ideas. 


Thank you for help & Nice Day
Silvio
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.