开发者

Read numbers after equals sign DOS Command Prompt

In Cmd.exe, how do I keep only the number after an equal sign in a text file?

Input file (input.txt) looks like...

Line1=1.234 开发者_StackOverflow社区

Line2=5.432

.

.

Line10=3.456

I want the outuput file (output.txt) to look like...

1.234

5.432

.

.

3.456

Thank you for your help.


This should do it:

FOR /F "delims== tokens=2" %%a IN (input.txt) DO @ECHO %%a >> output.txt


You would need to manipulate the input file in a Batch file. Here are some tips on string manipulation commands:

http://www.dostips.com/DtTipsStringManipulation.php


With sed:

sed "s/^line[0-9]\+=//g" input.txt > output.txt
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜