Computing.Net > Forums > Programming > Search for string on multi comp

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Search for string on multi comp

Reply to Message Icon

Name: Hawaiian Sun
Date: January 28, 2007 at 03:25:33 Pacific
OS: NT/2000/XP
CPU/Ram: P4/1gig
Product: Dell
Comment:

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 use

I appreciate any help to this as I have been trying to get some batch files written with very little success.

Mahalo,
Hawaiian Sun



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: January 28, 2007 at 03:51:33 Pacific
Reply:

Are the drives mapped to a letter?


=====================================
If at first you don't succeed, you're about average.

M2



0

Response Number 2
Name: Hawaiian Sun
Date: January 28, 2007 at 12:38:06 Pacific
Reply:

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


0

Response Number 3
Name: Hawaiian Sun
Date: January 30, 2007 at 02:01:51 Pacific
Reply:

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


0

Response Number 4
Name: Mechanix2Go
Date: January 30, 2007 at 04:06:05 Pacific
Reply:

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



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Search for string on multi comp

Batch file to search for strings www.computing.net/answers/programming/batch-file-to-search-for-strings/17549.html

Search for string? (C++) www.computing.net/answers/programming/search-for-string-c/13287.html

search for string in batch www.computing.net/answers/programming/search-for-string-in-batch/16124.html