Name: QZero Date: May 1, 2008 at 19:31:28 Pacific Subject: Filter text files! OS: WinXP CPU/Ram: 2GB Model/Manufacturer: IBM server
Comment:
Hi All,
I need to collect some logs everyday and I am try to write a DOS batch program to do it. But since I am new to the DOS command, can everyone please help!
The log file contain like this : [blankline] [2008.03.02-20.00.23 kfdakjklefsfda] 123456 [blankline] [2008.03.02-20.10.23 kfdakjklefsfda] 232645 [blankline] [2008.03.02-20.00.23 kfdakjklefsfda] date [2008.03.02-20.04.03 kfdakjklefsfda] time [2008.03.02-20.56.13 kfdakjklefsfda] set [2008.03.02-20.44.03 kfdakjklefsfda] info [blankline]
What I really like to collect is the last part, between the last third blankline and the last second blankline! The output I expect is:
[2008.03.02-20.00.23 kfdakjklefsfda] date [2008.03.02-20.04.03 kfdakjklefsfda] time [2008.03.02-20.56.13 kfdakjklefsfda] set [2008.03.02-20.44.03 kfdakjklefsfda] info
===================================== If at first you don't succeed, you're about average.
Thanks for your help! But I guess I do not ask the question right :-( Since the log file might have a lot of line, some time 20, sometime more than 100!
The script you write is set to output the line form line 6 to 9! It is not always ture for my case!
I am more thinking like find the last second blankline and start to export until it meet the last blankline!
blankline] [2008.03.02-20.00.23 kfdakjklefsfda] 123456 [blankline] [2008.03.02-20.10.23 kfdakjklefsfda] 232645 . . . [blankline] <-----find the line number:x [2008.03.02-20.00.23 kfdakjklefsfda] date [2008.03.02-20.04.03 kfdakjklefsfda] time [2008.03.02-20.56.13 kfdakjklefsfda] set [2008.03.02-20.44.03 kfdakjklefsfda] info [blankline] <-----find the last line:y
I get a problem to run the script, it only export one line...the sixth line! And I add a line inside the for loop so it will echo the vaule of N; however, the %N% always show 0! any idea??
The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE