i'm newbie in VBScripting and i'd create one script to collect system
information and i have other application that generates logs what i need to
do is to have a VBscript that read log files and ONLY copy some fields then
append it to the output file generated by my first script.

Any Help

Re: Consolidate Specific Fields in text files to 1 Big File by Ayush

Ayush
Mon Dec 11 05:39:22 CST 2006

Replied to [Ahmed H. Habashy]s message :
-----------------------------------------------------------
> i'm newbie in VBScripting and i'd create one script to collect system
> information and i have other application that generates logs what i need to
> do is to have a VBscript that read log files and ONLY copy some fields then
> append it to the output file generated by my first script.
>
> Any Help

Give an example of Log so that someone can give you the script to extract the info
from log

--
Ayush [ Good :-) Luck ]
-------------
Search - www.Google.com | Wikipedia - http://en.wikipedia.org
Snip your long urls - http://snipurl.com/
-------------



Re: Consolidate Specific Fields in text files to 1 Big File by Ahmed

Ahmed
Tue Dec 12 04:14:21 CST 2006

Here is a sample of the log File Generated by the application and i need to
choose some fields to be copied or appended to my Report .txt file which is
generated by a VB Script.

=================================================
Process Name : svchost.exe
Process ID : 1204
Protocol : TCP
Local Port : 135
Local Port Name : epmap
Local Address : 0.0.0.0
Remote Port :
Remote Port Name :
Remote Address : 0.0.0.0
Remote Host Name :
State : Listening
Process Path : C:\WINDOWS\system32\svchost.exe
Product Name : Microsoft® Windows® Operating System
File Description : Generic Host Process for Win32 Services
File Version : 5.1.2600.2180 (xpsp_sp2_rtm.040803-2158)
Company : Microsoft Corporation
Process Created On: 11/12/2006 10:49:31 Õ
User Name :
Process Services : RpcSs
Process Attributes: A
==================================================

Thanks For Help


"Ayush" <ayushmaan.j[aatt]gmail.com> wrote in message
news:OiCbjkRHHHA.1188@TK2MSFTNGP06.phx.gbl...
> Replied to [Ahmed H. Habashy]s message :
> -----------------------------------------------------------
>> i'm newbie in VBScripting and i'd create one script to collect system
>> information and i have other application that generates logs what i need
>> to
>> do is to have a VBscript that read log files and ONLY copy some fields
>> then
>> append it to the output file generated by my first script.
>>
>> Any Help
>
> Give an example of Log so that someone can give you the script to extract
> the info from log
>
> --
> Ayush [ Good :-) Luck ]
> -------------
> Search - www.Google.com | Wikipedia - http://en.wikipedia.org
> Snip your long urls - http://snipurl.com/
> -------------
>
>



Re: Consolidate Specific Fields in text files to 1 Big File by Ayush

Ayush
Wed Dec 13 05:39:49 CST 2006

Replied to [Ahmed H. Habashy]s message :
-----------------------------------------------------------
> Here is a sample of the log File Generated by the application and i need to
> choose some fields to be copied or appended to my Report .txt file which is
> generated by a VB Script.
[[[snippedddd]]]]

I am new to VBScript but i made this JScript. No difference, you can use this by
pasting this in Notepad and saving as .hta extension. :

--------Dont-Include-This-Line------------------------
<script>
onerror=cerr
function cerr(a,b,c){
alert('Error occured !! Script will now close.');
window.close();
return true
}
//Dont Edit above this line

Append="Process Name,Process Id,State"
FilePath="E:\\Tempp\\Report.txt";

//Dont edit below this line
Append=Append.split(',');
oSF=new ActiveXObject("Scripting.FilesystemObject")
ReadF=oSF.OpenTextFile("E:\\Tempp\\aaa.xx",1)
Arr = ReadF.ReadAll();
ReadF.Close()
Arr=Arr.toString().split('\n')
Arr2=new Array();
for(x=0;x<Arr.length;x++){
sep=Arr[x].indexOf(':');
Arr2[x]=Arr[x].substring(sep+1,Arr[x].length);
Arr[x]=Arr[x].substring(0,sep);
}
lineNs=''
for(xx=0;xx<Append.length;xx++){
for(xxx=0;xxx<Arr.length;xxx++){
if(Arr[xxx].indexOf(Append[xx])!='-1'){
lineNs+=Arr[xxx]+':'+Arr2[xxx]+'\n';
}}}
if(oSF.FileExists(FilePath)!=true){
alert('File "'+FilePath+'" does not exist...Script will now close.')
window.close()
}
appendTF=oSF.GetFile(FilePath);
openF=appendTF.OpenAsTextStream(8)
openF.Write('\n'+lineNs)
openF.Close()
window.close()
</script>
--------Dont-Include-This-Line------------------------

It will do the same....

You have to change two things:
1. The value of the first Append that is now :
"Process Name,State"
Dont remove quotes. SPecify the values you want to copy by a comma (,) like in this
example the script will append the line Process Name and State line. If you want to
copy the values only(svchost.exe etc.), tell me.

2. Change the value of FilePath that is :
FilePath="E:\\Tempp\\Report.txt"
to
FilePath="TheReportFilePath"
Note that two backslahes is are equal to one backslash in JScript so this will be
wrong :::
FilePath="E:\Tempp\Report.txt"








Ayush [ Good :-) Luck ]
-------------
Search - www.Google.com | Wikipedia - http://en.wikipedia.org
Snip your long urls - http://snipurl.com/
-------------