中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-09 20:02
47,811 topics / 349,896 posts / today 1 new / 48,254 members
DOS批处理 & 脚本技术(批处理室) » Experts, please help optimize the code
Printable Version  2,833 / 41
Floor16 HAT Posted 2008-09-14 21:26
版主 Posts 5,017 Credits 9,023
Floor17 dragonamd Posted 2008-09-14 21:45
中级用户 Posts 100 Credits 209
It doesn't work when used together with batch processing. I haven't used this yet. How exactly to use it? Can you teach me?
Floor18 HAT Posted 2008-09-14 21:53
版主 Posts 5,017 Credits 9,023
How do you know it can't be used with batch files if you haven't used it yet?
First, take a look at the help:
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.
Floor19 dragonamd Posted 2008-09-14 22:01
中级用户 Posts 100 Credits 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
And the gawk doesn't work properly when used together, 。
Floor20 slore Posted 2008-09-14 23:11
铂金会员 Posts 2,478 Credits 5,212
VBS is slow because it sorts, you just want the largest... The time complexity is 1
Floor21 HAT Posted 2008-09-15 00:27
版主 Posts 5,017 Credits 9,023
What are the specific manifestations of "abnormal"?
Floor22 dragonamd Posted 2008-09-15 00:37
中级用户 Posts 100 Credits 209
Who can solve this.
The error shown is
gawk:cmd. line:2:fatal: cannot open file 'your_file for reading <no such file or directory>
Floor23 lxmxn Posted 2008-09-15 07:08
版主 Posts 4,938 Credits 11,386
gawk:cmd. line:2:fatal: cannot open file 'your_file for reading <no such file or directory>
Do you have the file 'your_file'?

Replace 'your_file' with your own data file!
Floor24 dragonamd Posted 2008-09-15 10:01
中级用户 Posts 100 Credits 209
It simply doesn't work. Moderator, can you use this code normally?
Floor25 HAT Posted 2008-09-15 11:18
版主 Posts 5,017 Credits 9,023
What are the specific manifestations of "simply not working"?
Floor26 dragonamd Posted 2008-09-15 12:48
中级用户 Posts 100 Credits 209
Other gawks here can be used, but mine can't
Floor27 HAT Posted 2008-09-15 13:00
版主 Posts 5,017 Credits 9,023
Post the error message to have a look?
Floor28 dragonamd Posted 2008-09-16 02:00
中级用户 Posts 100 Credits 209
You run normally, but I don't run normally. So depressed
Floor29 HAT Posted 2008-09-16 10:01
版主 Posts 5,017 Credits 9,023
There is no normal operation, there must be some phenomenon, right?
Floor30 dragonamd Posted 2008-09-16 20:59
中级用户 Posts 100 Credits 209
The error shown is:
gawk:cmd. line:2:fatal: cannot open file 'your_file for reading <no such file or directory>
Still like this, I don't know why you can be normal.
Prev  1 2 3  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023