1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- BEGIN{
- styles=0
- in_style=0
- rows=-1
- }
- {
- if(match($0,"^ *<Table")){
- rows=0
- print
- next
- }
- if(match($0,"^ *</Table")){
- rows=-1
- print
- next
- }
- if(match($0,"^ *<Row[ >]")){
- if(rows<4)rows++
- }
- if(rows>-1){
- if(rows<4)
- gsub(" ss:StyleID=\"\\w+\""," ss:StyleID=\"s1\"",$0)
- else
- gsub(" ss:StyleID=\"\\w+\"","",$0)
- }
- # if(match($0,"^ *<Style ")){
- # if(styles<3) styles++
- # }
- if(match($0,"^ *<Style ")){
- in_style=1
- if(styles==0){
- styles++
- print
- next
- }
- else if(styles==1) {
- gsub("ss:ID=\"\\w+\"","ss:ID=\"s1\"",$0)
- styles++
- print $0
- next
- } else {
- if(styles<3) styles++
- in_style=1
- }
- }
- if(match($0,"^ *</Style>")){
- in_style=0
- if(styles>2 )next
- }
- if(in_style && styles>2 )next
- print $0
- }
|