On Wed, 26 Mar 2008 02:45:40 +0100,
Janis Papanagnou <Janis_Papanagnou@[EMAIL PROTECTED]
> wrote:
[...]
> You can write two gensub()s, where you replace the third
> [[:digit:]]{2} subpattern by 0[[:digit:]] and [1-9][[:digit:]], resp.,
> and add the respective century information before the replacement \\3.
Good idea, this seemed to work:
awk --re-interval '{
sub(/ end,/, " ending,")
if ($0 ~ /[[:digit:]]{2}\/[[:digit:]]{2}\/[[:digit:]]{2}/) {
$0=gensub(/([[:digit:]]{2})\/([[:digit:]]{2})\/([1-9])([[:digit:]])/,
"19\\3\\4-\\1-\\2", "g")
$0=gensub(/([[:digit:]]{2})\/([[:digit:]]{2})\/0([[:digit:]])/,
"200\\3-\\1-\\2", "g")
}
print
}'
The regexps are a bit nasty though. Thanks!
--
Seb


|