0

对多个文本文件进行拼写检查。

将表单输出为 'gcc' 会生成它:

   intro/main.txt:12:                  'hierarchie' -- orthograph
   concepts/detail/experiment.txt:12:  'propper' -- orthograph

是对“待办事项”列表的一个很好的正式描述。此外,它还支持 vim 和 emacs 等 IDE 的拼写检查。他们可以解析此内容并在按钮按下时跳转到焦点位置。

我想在多个文本文件上运行 ispell/aspell 并以类似编译器错误的方式生成错误列表。

4

1 回答 1

1
for file in $(find . -name "*.tex" -type f); \
  do for word in $(cat $file | aspell list); \
     do grep -sHIno "\b$word\b" $file \
        | sort -u; 
     done; 
  done > tmp.log

也就是说,第一个 for 循环遍历关注的文件——这里是目录子树中的“.tex”文件。嵌套的 for 循环遍历 'aspell' 抱怨的单词。'grep' 命令 greps 行号并生成类似编译的消息。选项'-o' 只打印匹配的部分,即拼写错误的单词。'sort -u' 确保一行上的两个错误不会产生双重输出。

将其重定向到 '> tmp.log',将 vim 设置为 'set makeprg=cat',然后使用 ':make tmp.log' 可以方便地遍历文档中的所有拼写错误。

欢迎任何评论。

于 2015-12-12T15:04:25.090 回答