首页 > 解决方案 > MS-DOS 输出应打印在 *txt 文件上

问题描述

编辑: 我正在验证 XHTML 文件。因此我使用下面的代码来解析 xhtml 文件(特别是来自这个 jar 文件而不是解析模块)

MS-Dos Prompt 上打印的输出如下:

"file:009_chapter004_9783990309544.xhtml":830.1-830.5: info warning: A table row was 1 columns wide, which is less than the column count established by the first row (2).
"file:009_chapter004_9783990309544.xhtml":833.1-833.5: info warning: A table row was 1 columns wide, which is less than the column count established by the first row (2).
"file:009_chapter004_9783990309544.xhtml":836.1-836.5: info warning: A table row was 1 columns wide, which is less than the column count established by the first row (2).
"file:009_chapter004_9783990309544.xhtml":839.1-839.5: info warning: A table row was 1 columns wide, which is less than the column count established by the first row (2).
"file:009_chapter004_9783990309544.xhtml":842.1-842.5: info warning: A table row was 1 columns wide, which is less than the column count established by the first row (2).
"file:009_chapter004_9783990309544.xhtml":845.1-845.5: info warning: A table row was 1 columns wide, which is less than the column count established by the first row (2).
"file:009_chapter004_9783990309544.xhtml":826.1-826.33: error: Table column 2 established by element ΓÇ£tdΓÇ¥ has no cells beginning in it.

在 perl 脚本中如何从以下命令转换MS-Dos output为文件:*.txt

#Try - 1 
system("java -Xss512k -jar \"c:/vnu.jar_18.11.5/dist/vnu.jar\" 009_chapter004_8883990309533.xhtml >Output.txt");

#Try - 2 
my $output = system("java -Xss512k -jar \"c:/vnu.jar_18.11.5/dist/vnu.jar\" 009_chapter004_8883990309533.xhtml");

#Try - 3 
perl -w htmlvalidation.pl  >Output.txt;

但是上面的代码没有成功。有人可以帮我解决这个问题。

标签: perl

解决方案


我得到了答案 - N Deepak Prasath

我无法理解以下情况,但幸运的是我得到了答案:

我们需要添加 2>> output.txt而不是使用>output.txt

试过的代码:

system("java -Xss512k -jar vnu.jar 009_chapter004_8883990309533.xhtml >Output.txt");

现在工作代码:

system("java -Xss512k -jar vnu.jar 009_chapter004_8883990309533.xhtml 2>>Output.txt");

我从过去两天开始尝试/搜索上述内容,现在我得到了答案并在这里更新,因为有人从上述内容中受益。


推荐阅读