我想从 tex 文件中提取 pspictures 并将其放入另一个文件中,以便它们可以很容易地处理成 ps 或 pdf



我有一个文件列表.tex文件,其中包含tex中的片段,这些片段构建了处理速度很慢的ps图片。

多个文件中有多个片段,结束分隔符end{pspicture}

% this is the beginning of the fragment
begin{pspicture}(0,0)(23,5)
rput{0}(0,3){crdKs}
rput(1,3){crdtres}
rput(5,3){crdAh}
rput(6,3){crdKh}
rput(7,3){crdsixh}
rput(8,3){crdtreh}
rput(12,3){crdQd}
rput(13,3){crdeigd}
rput(14,3){crdsixd}
rput(15,3){crdfived}
rput(16,3){crdtwod}
rput(20,3){crdKc}
rput(21,3){crdfourc}
end{pspicture}

我想提取碎片。

我不知道该怎么做?awk可以这样做还是sed

它们似乎逐行工作,而不是在整个片段上工作。

我并不是真的在寻找解决方案,而只是一个好的候选工具。

sed -En '/^\begin{pspicture}.*$/,/^\end{pspicture}.*$/p' file

将 sed 与 -E 用于正则表达式。

使用//,//确定开始和结束正则表达式,并打印从开始到结束的所有行。

相关内容

最新更新