中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟
中国DOS联盟论坛
现在时间是 2026-08-09 20:02
47,811 主题排行 / 349,896 发帖 / 今日 1 篇 / 48,254 会员排行
DOS批处理 & 脚本技术(批处理室) » 高手们帮忙优化一下代码
可打印版本  2,832 / 41
第16楼 HAT 发表于 2008-09-14 21:26
版主 发帖 5,017 积分 9,023
第17楼 dragonamd 发表于 2008-09-14 21:45
中级用户 发帖 100 积分 209
和批处理放一起使用不了,。这个还没用过,具体怎么使用,能教一下吗
第18楼 HAT 发表于 2008-09-14 21:53
版主 发帖 5,017 积分 9,023
还没用过如何知道和批处理放一起使用不了?
先看看帮助吧:
gawk --help
Usage: gawk -f progfile file ...
Usage: gawk "program" file ...
POSIX options: GNU long options:
-f progfile --file=progfile
-F fs --field-separator=fs
-v var=val --assign=var=val
-m val
-W compat --compat
-W copyleft --copyleft
-W copyright --copyright
-W dump-variables --dump-variables
-W gen-po --gen-po
-W help --help
-W lint --lint
-W lint-old --lint-old
-W non-decimal-data --non-decimal-data
-W profile --profile
-W posix --posix
-W re-interval --re-interval
-W source=program-text --source=program-text
-W traditional --traditional
-W usage --usage
-W version --version

To report bugs, see node `Bugs' in `gawk.info', which is
section `Reporting Problems and Bugs' in the printed version.
第19楼 dragonamd 发表于 2008-09-14 22:01
中级用户 发帖 100 积分 209
gawk "{for (i=1;i<=NF;i++) { if($i~/^5-[0-9]/){ split($i,a,/-/); if(a[2]>max) max=a[2]; }}} END{print max}" your_file
和gawk放一起使用不正常啊,。
第20楼 slore 发表于 2008-09-14 23:11
铂金会员 发帖 2,478 积分 5,212
VBS慢因为它排序了,你只要最大的。。。时间复杂度是1
第21楼 HAT 发表于 2008-09-15 00:27
版主 发帖 5,017 积分 9,023
"不正常"的具体表现是?
第22楼 dragonamd 发表于 2008-09-15 00:37
中级用户 发帖 100 积分 209
谁能解决一下。
表现的错误是
gawk:cmd. line:2:fatal: cannot open file 'your_file for reading <no such file or directory>
第23楼 lxmxn 发表于 2008-09-15 07:08
版主 发帖 4,938 积分 11,386
gawk:cmd. line:2:fatal: cannot open file 'your_file for reading <no such file or directory>
你有 your_file 这个文件吗?

把 your_file 替换成你自己的数据文件!
第24楼 dragonamd 发表于 2008-09-15 10:01
中级用户 发帖 100 积分 209
根本用不了,。斑竹这代码你可以正常使用 ?
第25楼 HAT 发表于 2008-09-15 11:18
版主 发帖 5,017 积分 9,023
“根本用不了”的具体表现又是什么?
第26楼 dragonamd 发表于 2008-09-15 12:48
中级用户 发帖 100 积分 209
在这里其他的gawk可以用,就我的不能用
第27楼 HAT 发表于 2008-09-15 13:00
版主 发帖 5,017 积分 9,023
报错信息贴出来看看?
第28楼 dragonamd 发表于 2008-09-16 02:00
中级用户 发帖 100 积分 209
你们运行正常,我运行不正常,郁闷
第29楼 HAT 发表于 2008-09-16 10:01
版主 发帖 5,017 积分 9,023
运行不正常,总得有什么现象吧?
第30楼 dragonamd 发表于 2008-09-16 20:59
中级用户 发帖 100 积分 209
表现的错误是
gawk:cmd. line:2:fatal: cannot open file 'your_file for reading <no such file or directory>
还是这样,我不知道你们为什么能正常,
上一页  1 2 3  下一页
[ 联系联盟系统管理团队 - 中国DOS联盟 - 标准版 ]
Sponsored by ifanr Inc | © 2001–2023