在DOS中使用FOR/f [英] FOR /f in DOS alternative

查看:81
本文介绍了在DOS中使用FOR/f的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎没有DOS版本(从WinME"DOS"到6.22)或FreeDOS,都不允许您使用文本文件并将其设置为变量,我将继续收集获得的数据在DOS模式下放入一个非常大的文件,但我想不出一种方法来获取每个assetUUID并将它们添加到第三个文件中……这是我现在得到的:

As it appears there is no version of DOS (6.22 to WinME "DOS") or FreeDOS that allows you to take part of a text file and make it a variable, I'm going to just keep collecting the data I get in DOS mode into one very large file but I can't think of a way to get each asset and UUID and add them together in a third file... Here is what I get at the moment:

SMBIOS.TXT

SMBIOS.TXT

~~~~~~~(usually 27 lines of stuff I don't need)~~~~~~~
Asset Number: ABC12345
~~~~~~~(usually 37 lines of stuff I don't need)~~~~~~~
UUID: ABCDEF12345678901234567890
~~~~~~~(usually 4 lines of stuff I don't need, complicated by a # symbol in there too)~~~~~~~
^Repeated many times

我需要以CSV格式将资产编号和UUID一起添加,因此我以前希望(在我用尽所有尝试在DOS中进行for /F之前)只是回显我正在创建的两个变量,如下所示:

I need to add both the Asset Number and the UUID together in a CSV format so I was previously hoping (before I exhausted all attempts at doing for /F in DOS) just echoing the two variables I was creating as follows:

ECHO !Asset!,!UUID!>>Results.CSV

这又可以在Windows命令提示符下运行而不是在DOS下运行,但是我正在使用的脚本仅获取每个脚本的第一个变量,因此我需要按顺序进行操作,并以这种方式重复遍历文件?

Which again works in Windows command prompt just not DOS, the script I'm using however only gets the first variable of each so I need to do them in order and keep repeating through the file in the manner?

或者还有其他方法可以使用DOS即时从两个文本文件中获取我需要的信息吗?这些都是通过USB记忆棒运行的,因此至少我没有任何尺寸限制.

Alternatively is there any other way I could use DOS to get the info I need out of the two text files on the fly? It's all running from a USB stick so I don't have any size constraints at least.

亚伦

推荐答案

您可以使用DOS命令行文本流编辑器EDLIN完成它.

我假设必须在DOS中完成此操作,而Windows无法选择.

PDGREPPE是MS DOS命令行GREP搜索和替换实用程序.

也许您可以找到带有宏的DOS文本编辑器

莲花123? DBase的? 用DOS BASIC编写一个应用程序.

You may be able to get it done with the DOS command line text stream editor EDLIN.

I am assuming this has to be done in DOS and Windows is not an option.

PDGREPPE is an MS DOS command line GREP search and replace utility.

Maybe you can find a DOS Text Editor with Macros

Lotus 123? DBase? Write an app in DOS BASIC.

这篇关于在DOS中使用FOR/f的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆