如何通过文本文件编写 hunpos 脚本?
我的目的是使用 POS 解析器 HunPos http://code.google 解析多个文本文件。 com/p/hunpos/wiki/UserManualI
有没有办法通过一堆文本文件来bash脚本hunpos?
my purpose is to parse several text files using the POS parser HunPos http://code.google.com/p/hunpos/wiki/UserManualI
is there a way to bash script hunpos through a bunch of text files?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
典型的机制如下:
我经常运行如下命令:
for f in *;做 echo -n "$f " ;猫 $f ; done
查看目录中所有文件的内容。 (特别适合/proc/sys/kernel/
风格的目录,其中所有文件的内容都非常短。)或者
类似
find 的东西。 -type f -exec file {} \;
或find . -type f -print0 | xargs -0 file
(仅当命令在输入期间接受多个文件名时才有效)。当然,如果程序接受多个文件名参数(例如
cat
或more
或类似的 Unix shell 工具)并且所有文件都在一个目录中,您可以非常轻松地运行:cat *
(显示目录中所有文件的内容)或cat *.*
(显示文件名中带有句点的所有文件的内容)。如果您经常需要“所有[子]*目录中的所有文件”,则 zsh
**/
选项很方便:ls -l **/*.c
会显示foo/bar/baz.c
和立即/blort/bleet/boop.c
。简洁的工具,但我通常不介意编写等效的find
命令,我只是不经常需要它。 (而且 zsh 并没有安装在所有地方,因此将来依赖它的功能可能会令人沮丧。)Typical mechanisms look like:
I often run commands like:
for f in *; do echo -n "$f " ; cat $f ; done
to see the contents of all the files in a directory. (Especially nice with/proc/sys/kernel/
-style directories, where all the files have very short contents.)or
or
Something like
find . -type f -exec file {} \;
orfind . -type f -print0 | xargs -0 file
(only works if the command accepts multiple filenames during input).Of course, if the program accepts multiple filename arguments (like
cat
ormore
or similar Unix shell tools) and all the files are in a single directory, you can very easily run:cat *
(show contents of all files in the directory) orcat *.*
(show contents of all files with a period in the filename).If you frequently want "all files in all [sub]*directories", the zsh
**/
option can be handy:ls -l **/*.c
would show youfoo/bar/baz.c
and/blort/bleet/boop.c
at once. Neat tool, but I usually don't mind writing thefind
command equivalent, I just don't need it that often. (And zsh isn't installed everywhere, so relying on its features could be frustrating in the future.)