perl - 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;
但是上面的代码没有成功。有人可以帮我解决这个问题。
解决方案
我无法理解以下情况,但幸运的是我得到了答案:
我们需要添加 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");
我从过去两天开始尝试/搜索上述内容,现在我得到了答案并在这里更新,因为有人从上述内容中受益。
推荐阅读
- python - 如何阅读随机森林的拟合结果?sklearn
- java - 插入排序java
- kubernetes - 使用 Prometheus 从其他 Kubernetes 集群监控 Kubernetes 集群
- azure-virtual-machine - Terraform 在“根”模块中报告“未声明名为“模块名称”的模块
- parallel-processing - 从 python 调用 Fortran 的 MPI
- r - 将 Jags 模型转换为 stan 模型
- python - 值是列表的Python系列,获取另一个系列的索引列表对应于每个项目列表
- excel - 编写一个返回客户身体类型的函数
- node.js - 如何从 VSCode 的内置 Node.js 运行 js 文件?
- javascript - 为 iFrame 文档添加打印按钮