BEGIN { file = "" } / (.*) <\/H.>/ { if( length( file ) > 0 ) { print "" >> file print "" >> file close( file ) } file = $0 gsub( / (.*) <\/H.>/, "", file ) file = file ".htm" if( length( dir ) > 0 ) { file = dir "/" file } title = $0 gsub( / /, "", title ) gsub( / <\/H.>/, "", title ) print "" > file print "" title "" >> file print "" >> file print "

" title "

" >> file next } length( file ) > 0 { line = $0 while( match( line, /]*)\">/ ) ) { temp = substr( line, 0, RSTART + 8 ) temp = temp substr( line, RSTART + 10, RLENGTH - 12 ) ".htm" temp = temp substr( line, RSTART + RLENGTH - 2 ) line = temp } print line >> file }