I don't understand what I was doing wrong.
I tried the following (what I thought the simplest and most direct), but it would not match the filename string passed by outfile (Text/content_001_One.html):
switch( outfile ){
case *.html :
doctype="application/xhtml+xml" ;
break;
default : ;
} ;
I also tried (still without success):
switch( outfile ){
case /*.html/ :
case /*.html$/ :
case /*[.]html/ :
doctype="application/xhtml+xml" ;
break;
default : ;
} ;
I was forced to resort to this
n=split( outfile, pathName, "." ) ;
printf("\t\t Suffix of outfile => %s ...\n", pathName[n] ) | "cat 1>&2" ;
switch( pathName[n] ){
case "html" :
doctype="application/xhtml+xml" ;
break;
default : ;
} ;
I would prefer to use the outfile value directly instead of the workaround.
Can someone please show me what the correct form would be?
*
means "zero or more of the previous character", you need.*\.html
probably. Good luck.*
as the first character in a regexp is undefined behavior per POSIX so YMMV with what any awk would do with that.foo
just writefoo$
. Adding.*
in a regexp (or*
in a globbing pattern) in front offoo
is pointless unless you wanted to capture the matching string to do something with it, which you don't.