Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Aloha,
Can a batch file be written to search through multiple computers (say server-1 to server-10 on the network), look for a particular string (say "Replaced converter") in multiple text files (*.sto) located on those servers, and then copy that string/line of text from each .sto file to a central text file located on server 11 called say... ReplacedConverters.txt?
Each .sto file is essentially a text log file with the extension (.sto). Each of these log files have various lines of text info, but I am mainly concerned with the line of text that has "Replaced converter". The lines are delinated by spaces. Here is an example of that line:
104 14:19:29.000 headend Replace converter cnv 00:61:51:a6 site 959: ROM address already in useI appreciate any help to this as I have been trying to get some batch files written with very little success.
Mahalo,
Hawaiian Sun

Are the drives mapped to a letter?
=====================================
If at first you don't succeed, you're about average.M2

Aloha Mechanix2Go,
All servers 1 thru 10 have a c:\folder-a\folder-b where the log (.sto) files are located.
By "drives mapped to a letter" do you mean mapping a network drive, or physical hard drives on each server? I was hoping to be able to use IP addresses like \\172.20.254.10-20 in the batch file to locate and run the search for the string then copy string to server-11 ReplacedConverter.txt.
I was looking into the use of mapping the network drives whereby server-1 would be drive E:\, server-2 be drive F:\, etc on the local computer performing the batch operation, but I just couldn't get the code written (getting too confused on how to actually write it). Anyway, either thru IP or mapped network drives using windows tools...
Say server-11 would be the collection server. This server-11 would also have a drive c:\ReplacedConverters folder.
Thanks for your help Mechanix2Go. In looking through all the postings, you have quite the reputation as being one of the best in this area.
Mahalo,
Hawaiian Sun

I'm starting to realize that I need to map the drives using the local computer in order to run the search.
Earlier relational threads mentioned about finding a string and copy the whole file to another folder: (as in the example below)
setLocal EnableDelayedExpansion
pushd \\172.20.254.10\folder-a\folder-b
for /f "tokens=*" %%F in ('dir /b/a-d') do (
type %%F | find "Replace converter" > nul
if not errorlevel 1 copy "%%F" c:\ReplacedConveters
)
popd
How can I... instead of copying the whole file, just copy the found string/line in those multiple text files to another text file called Replaced.txt in the c:\ReplacedConverters folder?In other words everytime a new text file is created with the following line in it:
104 14:19:29.000 headend Replace converter cnv 00:61:51:a6 site 959: ROM address already in use...it will collect that line in the Replaced.txt file. (Planning for AT scheduler)
What I am really trying to do is to collect all the log files that have this "Replace converter" line in it into 1 file to later import into a database to run reports.
Any help would be greatly appreciated.
Mahalo

Hi,
I'm working on it.
I don't have a newtwork so I tried this but no go:
C:\temp\-\multserv>pushd \\127.0.0.1\files
The network name cannot be found.But to append the found lines:
find "blabla" < filename >> my.txt
=====================================
If at first you don't succeed, you're about average.M2

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |