在 OpenVMS 中编写脚本很困难
我在 OpenVMS 中编写脚本时遇到了困难 我在名为 test.txt 的文件中有一定的输出。例如:
[WWEWE@http-lx-as code]$ cat test.txt
** Configuration for file "MULTINET:NETWORK_DEVICES.CONFIGURATION" **
Device Adapter CSR Address Flags/Vector
------ ------- ----------- ------------
se0 (Shared VAX/VMS Ethernet) -NONE- -NONE- -NONE-
s10 (Serial Line IP) -NONE- -NONE- -NONE-
dn0 (IP over DECNet link) -NONE- -NONE- -NONE-
我在 Linux 中编写了一个脚本,它有助于获取设备列下的所有信息,在本例中为 se0,s10,dn0。 我们可以在 OPEN VMS 中做类似的事情
Linux 脚本如下: 脚本:
for i in `cat test.txt 2>/dev/null |egrep '^[a-z]' |grep -v '\*\*' | awk '{print $1}'`
> do
> echo Begin-interface: $i
> done
输出:
Begin-interface: se0
Begin-interface: s10
Begin-interface: dn0
让我知道是否可以实现, 预先感谢您
I am having a very hard time with scripting in OpenVMS
I have a certain output in a file called test.txt .For example :
[WWEWE@http-lx-as code]$ cat test.txt
** Configuration for file "MULTINET:NETWORK_DEVICES.CONFIGURATION" **
Device Adapter CSR Address Flags/Vector
------ ------- ----------- ------------
se0 (Shared VAX/VMS Ethernet) -NONE- -NONE- -NONE-
s10 (Serial Line IP) -NONE- -NONE- -NONE-
dn0 (IP over DECNet link) -NONE- -NONE- -NONE-
I have written a script in Linux which helps to pick up all the information under the device column in this case se0,s10,dn0.
Can we do a similar thing in OPEN VMS
The Linux script is as follows :
SCRIPT :
for i in `cat test.txt 2>/dev/null |egrep '^[a-z]' |grep -v '\*\*' | awk '{print $1}'`
> do
> echo Begin-interface: $i
> done
OUTPUT :
Begin-interface: se0
Begin-interface: s10
Begin-interface: dn0
Let me know if it can be achieved,
Thanking you in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设您需要以“-”开头的行下方第一列中的任何内容
您可以在命令文件中尝试以下操作,例如 extract_if.com
使用以下命令运行此脚本:
输出应与指定的一样。
看来你对AWK很熟悉。您还可以安装适用于 OpenVMS 的 GAWK。
Assuming that you need anything in the first column below the line starting with '-'
you can try the following in a command file, e.g. extract_if.com
Run this script using:
The output should be as specified.
It seems you are familiar with AWK. You can also install GAWK for OpenVMS.
晚了两年......
我想我永远不会理解那些 Unix 脚本小家伙,他们认为他们需要 4 或 5 个管道命令,然后是合适的工具,一步完成所有事情。
将“cat”输出通过管道传输到 awk 或 perl 中是最明显、最令人讨厌的无知迹象。
哦,好吧……继续!
海因.
Two years late....
Guess I will never understand those Unix script weenies which think they need 4 or 5 piped commands, then the proper tool and do everything in one step.
Piping 'cat' output into awk or perl is the most obvious and obnoxious sign of clueless-ness.
Oh well... Onwards!
Hein.