How to get line value from txt file in cmd

July 21, 2010 at 04:25:39
Specs: Windows XP
Hello!

I need to get line value from txt file in cmd.
readme.txt content:
Schedule: normal
Author: user
Last revision: 5555

I need to get 5555 from the file.

Thanks!


See More: How to get line value from txt file in cmd

Report •

#1
July 21, 2010 at 06:06:33
download gawk for windows(see my sig), then use this one liner

c:\test> gawk -F":" "END{print $2}" readme.txt

GNU win32 packages | Gawk


Report •

#2
July 21, 2010 at 06:12:33
Hello!

Thanks for your replay, but I need to use only standard batch commands.

-- Igor


Report •

#3
July 21, 2010 at 06:16:38
Untested:

FOR /F "tokens=1,2 delims=:" %%a IN (readme.txt) DO (
    IF /I "%%a" EQU "Last Revision" ECHO %%a = %%b
)

When your only tool is a hammer, every problem looks like a nail.


Report •

Related Solutions

#4
July 21, 2010 at 06:21:46
Many thanks! it works! Great!

Report •

Ask Question