Board logo

标题: 请教Gawk的使用 [打印本页]

作者: BBMARK     时间: 2007-11-5 12:02    标题: 请教Gawk的使用

请教, GAWK如何在windows下使用,我看过本站的教程,可还是不行啊, 比如: net time > a.txt 现在我想把 这个a.txt中的日期抓出来,应该怎么使用Gawk? 如果我想把这个日期赋予某个变量,又该如何使用?

作者: abcd     时间: 2007-11-5 12:51
net time输出的内容贴上来

作者: BBMARK     时间: 2007-11-5 14:38
Current time at \\172.26.65.108 is 2007/11/5 上午 07:59 The command completed successfully. ###谢谢

作者: abcd     时间: 2007-11-5 14:52
@echo off gawk "/\// {print $6}" a.txt pause 这样不就提取出来了?

作者: BBMARK     时间: 2007-11-5 15:11
明白了,谢谢 那我还想把这个日期赋给变量,应该怎么办呢

作者: abcd     时间: 2007-11-5 15:19
for /f "delims=" %%i in ('gawk "/\// {print $6}" a.txt') do set dt=%%i 可能是这样吧,没测试

作者: BBMARK     时间: 2007-11-5 15:45
系统提示 : %%i was unexpected at this time 我用了个笨办法: gawk "/\// {print $6}" a.txt > date.dat set /p newdate="pls input" < date.dat

作者: abcd     时间: 2007-11-5 15:49
楼主是不是把我贴的直接复制到cmd里运行啊??

作者: BBMARK     时间: 2007-11-5 16:33
手输入的,我该怎么做呢?

作者: abcd     时间: 2007-11-5 16:36
我那句是写入P处理文件,再执行的 如果在cmd直接执行,把%%i改成%i

作者: BBMARK     时间: 2007-11-5 16:58
试过了,提示: More?

作者: BBMARK     时间: 2007-11-5 17:00
sorry,可以了, 谢谢