/p>.*/ { # Removes tags and bad characters gsub(/<[^>]*>/, "") ; gsub(/[^a-zA-Z0-9 ]/, "") # Trims leading and trailing spaces and tabs (if any) gsub(/^[ \t]*/, "") ; gsub(/[ \t]*$/, "") # Concatenates the current record to variable and shortens it, # when it gets too long desc = desc $0 if (length(desc) >= 200) { desc = substr(desc, 1, 197) "..." exit } } END { print desc }