unable to create SED command to make changes in lines other than starting with specific words -


i working on html project , have manipulate huge number of files, using sed, head & tail work got stuck @ point.

strings delete<i><font color="#000000"> , <font color="#000000"><i>

but not in lines starts <b><font color="#000000"><p align="justify"> , <p align="justify"> , </font></b><p align="justify"> `

by way have written 1 can't figure out whats problem it

sed -rei '/^<b><font color="#000000"><p align="justify">relations.|<p align="justify">|</font></b><p align="justify">/! s/<font color="#0000ff"><i>|<i><font color="#0000ff">//g' 

any or suggestions appreciated.

regards

edit: after looking @ htmls again got know want edit 8th line till end except last line of files

example

line 1 <i>some text<i> line 2 <i>some text<i> line 3 <i>some text<i> line 4 <i>some text<i> line 5 <i>some text<i> line 6 <i>some text<i> line 7 <i>some text<i> line 8 <i>some text<i> line 9 <i>some text<i> line 10 <i>some text<i> s       <i>some text<i> o       <i>some text<i> -       <i>some text<i> o       <i>some text<i> n       <i>some text<i>    line n <i>some text<i>     

to

line 1 <i>some text<i> line 2 <i>some text<i> line 3 <i>some text<i> line 4 <i>some text<i> line 5 <i>some text<i> line 6 <i>some text<i> line 7 <i>some text<i> line 8 text line 9 text line 10 text s       text o       text -       text o       text n       text    line n <i>some text<i> 

use different delimiter:

sed -rei 'x^(<b><font color="#000000"><p align="justify">)|(<p align="justify">)|(</font></b><p align="justify">)x! sx(<font color="#0000ff"><i>)|(<i><font color="#0000ff">)xxg' 

note how used x delimiter, because regex contains forward slashes, , if used typical delimiter of slash have escape them, hassle avoided.

also regex had text relations buried in it, removed .


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -