我有这个文件input.text,假设有20行。(尽管我希望能够使用任意数量的行)
因此,我想打开上述文件并使用每个字符串,就像它是另一个命令的参数一样。
另一个命令将获取每个参数,执行其功能,然后将输出写入另一个文件本身。
我如何才能完成预期的任务?
发布于 2017-11-18 05:20:08
下面是一个示例DCL命令文件,它读取INPUT.TXT,并将找到的行用作输出到名为DIROUT.TXT的文件的DIR命令的参数:
$! Read file using results as DIR command parameters...
$ file1="INPUT.TXT"
$ file2="DIROUT.TXT"
$ open/read chnl1 'file1'
$ on control_y then goto done_loop
$ on error then goto done_loop
$read_loop:
$ read/end_of_file=done_loop chnl1 opt1
$ write sys$output ">>> Sending DIR ",opt1," output to ''file2'..."
$ dir/out='file2' 'opt1'
$ goto read_loop
$done_loop:
$ close chnl1
$ write sys$output "Finished..."
$ EXIT您应该能够根据您的需求对其进行调整。
https://stackoverflow.com/questions/39971631
复制相似问题