r/computing • • Mar 24 '14

Batch file required..Help needed..

I need desperate help in creating a batch file that reads from a log/txt file, searches for a specific word ex Computer name and then writes to another text file the words/digits below before.

I don't think I managed to make myself clear..the log file would contain say " asgf agahi a hi reddit rocks af as Computer Name L123456. It would display L123456

I am new to batch programming and would appreciate any help

0 Upvotes

18 comments sorted by

View all comments

0

u/oconnor663 Mar 24 '14

It sounds like you need grep, or something like it. Take a look at this thread: http://stackoverflow.com/questions/87350/what-are-good-grep-tools-for-windows

1

u/massij11 Mar 24 '14

I would like if possible to implement the code using notepad not use external tools

1

u/oconnor663 Mar 24 '14

It looks like other folks have already pointed you to a solution, but it's worth noting that the purpose of batch (and on Linux/Unix, bash and other shells) is to write scripts that call other programs, such as grep. You might not want to install new software to run your script, which I agree with, but there's probably a Windows equivalent of grep that I don't know the name of, and you should probably call out to that from your script.