This package (built using the facilities of catchfile) provides a macro \catchfilebetweentags acts like the original \catchfile but only extracts a portion of the file instead of the complete file. The extracted portion can be delimited by strings or by docstrip tags: %<*tag> .... %</tag> (comments in the caught region may be included or dropped).