#!/usr/bin/awk -f # # quotes_dq2fq -- Oliver Fromme # # Convert US-ASCII double quotes to French quotes, # i.e. "foo bar" becomes »foo bar«. # NOTE: It is important that all quotes in the text # are balanced, i.e. the number must be even, every # opening quote must have a closing quote, and they # must not be nested within each other. # { line = $0; while (quote = index(line, "\"")) { newquote = is_open ? "«" : "»"; line = \ substr(line, 1, quote - 1) \ newquote \ substr(line, quote + 1); is_open = !is_open; } print line; } #--