我的问题是继续
我正在尝试将一系列命令集成到单个 shell 脚本中
解析欧洲标准以提取测试序列
将文本编码转换为 utf8
使用上面帖子中提供给我的 awk 例程处理结果。
将内容保存在目标文件中
我暂时写了下面的脚本。我能做到只step 1
和step 4
,但既不step 2
也没有step 3
。我想知道是否应该创建中间(临时)文件。我试图将中间步骤的输出存储到变量中,但没有成功。任何帮助也会对可能的错误和最好的方法有所帮助。
#!/bin/bash
# creating the Latex code for a test procedure
awkcommand= "/usr/bin/awk
'
$1 == "Group" {printf("\\section{%s %d}\n", $1, $2); next}
{
title = sep = ""
for (i=1; i<=NF; i++)
if ($i ~ /^[0-9][0-9][0-9]$/) {
printf("\\subsection{%s} \n\\TestDetails{%d}\n", title, $i)
break
}
else {
title = title sep $i
sep = FS
} …
Run Code Online (Sandbox Code Playgroud) 我有一个很长的法语文本文件需要清理。非 ASCII 字符已被奇数字符组合取代。例如,以下内容:
passer de très bonnes fêtes de fin d'année。
应该变成:(作为 Unicode 文本)
passer de très bonnes fêtes de fin d'année。
我试过 sed,但没有成功。一位朋友推荐尝试 Perl。我可以很容易地用奇怪的字符序列和正确的替换字符构建一个表格。理想情况下,我希望这张表是一个独立的文件,以备将来使用。此类转换的推荐方法是什么?