searching log files

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
joejames_786
Posts: 17
Joined: 12 Feb 2017 05:11

searching log files

#1 Post by joejames_786 » 15 Jan 2019 06:40

hi

someone pl help me.

I have a log file SERVER_ERROR.log which contain 100000 or more lines

i need a script that should read a file named SERVER_LIST.txt
which contain 2 columns of data ie.......

1 2

XX BACKUP
BX STORAGE
JX DATA
RE CARD
FD CUSTOMER
HH SERVER
....and so (around 100 servers)

the script should search the SERVER_ERROR.log file for occurrences of each server ID (column 1) and write it to a text file named
SORTED_ERROR_LOG.txt


ie....

XX BACKUP = 200
BX STORAGE = 12
JX DATA = 123
RE CARD = 220

..... and so on

please help me

thanx in advance

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: searching log files

#2 Post by aGerman » 16 Jan 2019 16:28

joejames_786 wrote:
15 Jan 2019 06:40
XX BACKUP = 200
What is the 200 for? The number lines found in the log file that begin with XX BACKUP?
What does "columns" mean? Are XX and BACKUP separated by a various number of spaces or always by the same number?

Steffen

joejames_786
Posts: 17
Joined: 12 Feb 2017 05:11

Re: searching log files

#3 Post by joejames_786 » 16 Jan 2019 18:53

hi

1.the 2 columns are seperated by a single tab space


2. the number 200 is possible number of lines in the SERVER_ERROR.LOG file.

3. only the "ID" ie....(XX BX JX RE) is written in the SERVER_ERROR.log and not the server name

Post Reply