Search the text file using vbscript.

Hi I have some data in my text file. Below is the content. Now I need to search the file whether it contains identityType as ApplicationPoolIdentity. Any help in vbscript???
 name:"example"
 queueLength:"1000"
 autoStart:"true"
 enable32BitAppOnWin64:"false"
 managedRuntimeVersion:"v2.0"
 managedRuntimeLoader:"webengine4.dll"
 enableConfigurationOverride:"true"
 managedPipelineMode:"Integrated"
 CLRConfigFile:""
 passAnonymousToken:"true"
 startMode:"OnDemand"
 [processModel]
   identityType:"ApplicationPoolIdentity"
   userName:""
   password:""
   loadUserProfile:"false"

ok my solution is below,
CONST ForReading = 1
Dim File1
Dim FileToRead
Dim strLine
Dim infoResult
Dim strDir, objFile, returnvalue
strDir = "C:\Scripts\"
File1 = "sample.txt"
FileToRead = strDir & File1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(FileToRead, ForReading)
Do Until objFile.AtEndOfStream
    strLine = objFile.ReadLine
        if instr(strLine, "identityType") <> 0 then
          if instr(strLine, "LocalSystem") <> 0 then
                infoResult = "Found"
                exit do
            end if
        else
            infoResult = "Not Found"
        end if
Loop
objFile.Close
 Wscript.Echo infoResult    
Set objFSO = Nothing
Set objFile = Nothing

Similar Messages

  • Log Error Messages in the Text File using Flex

    Hi,
    I am using try/Catch block to catch exception and am trying to write these error messages in the text file.
    I do not know how to achive such funcionality.
    looking forward for your help in this regard. Please have a look on the code as pasted below:
    private function onItemRollOver(evt : ListEvent) : void
                    try
                             var s:String= evt.target.Participation;
                               var partRange:Number = evt.rowIndex;
                            if (partRange == 2)
                                    dgCohorts.setStyle( "rollOverColor", "red" );
                            if (partRange == 7)
                                dgCohorts.setStyle( "rollOverColor", "green" );
                            dgCohorts.validateNow();
                       catch(e:Error)
                                var callLaterErrorEvent:DynamicEvent = new DynamicEvent("callLaterError");                        
                                callLaterErrorEvent.error = e;
                                systemManager.dispatchEvent(callLaterErrorEvent);
    Thanks,
    Vivek Jain

    Hi,
    I am using try/Catch block to catch exception and am trying to write these error messages in the text file.
    I do not know how to achive such funcionality.
    looking forward for your help in this regard. Please have a look on the code as pasted below:
    private function onItemRollOver(evt : ListEvent) : void
                    try
                             var s:String= evt.target.Participation;
                               var partRange:Number = evt.rowIndex;
                            if (partRange == 2)
                                    dgCohorts.setStyle( "rollOverColor", "red" );
                            if (partRange == 7)
                                dgCohorts.setStyle( "rollOverColor", "green" );
                            dgCohorts.validateNow();
                       catch(e:Error)
                                var callLaterErrorEvent:DynamicEvent = new DynamicEvent("callLaterError");                        
                                callLaterErrorEvent.error = e;
                                systemManager.dispatchEvent(callLaterErrorEvent);
    Thanks,
    Vivek Jain

  • Need to send the text file using webservice

    Hi,
    I want to send the text file with contains data through oracle pl/sql using webservice. How can i handle this program?
    Kindly share with your details.
    Thanks in advance,
    Maran

    user8732035 wrote:
    I want to send the text file with contains data through oracle pl/sql using webservice. How can i handle this program?Web services supply XML structured data. Not text files.
    PL/SQL supports web services (XML output) and web procedures (text and binary output).
    You need to clarify your requirements.

  • How do i split content from the text file using tab and spaces...?

    Hi.. Just want to ask help to all the experts. Im new in java and i have this problem on how to split the contents of the text file. ill show you the contents in order to let you see what i mean.
    FileName: COL.txt
    AcctNo AcctName Primary Secondary Status Opendate
    121244 IPI Company Noel Jose Active 12/05/2007
    As you can see the content i want to split it per column.. Please help me

    Jose_Noel wrote:
    Hi prometheuzz,
    What do you mean by one thread...?You created two threads* with the same question in it. That way, people might end up giving you an answer that has already been posted in your other thread: thus wasting that person's time.
    Just don't create multiple threads with the same question please.
    * a thread is a post here at the forum

  • Problem on appending the text file using FileConnection!!!

    it's in here...
    http://forum.java.sun.com/thread.jspa?threadID=718613&tstart=0
    my apology for double-cross posting..
    thanks much

    attachments
    Attachments:
    julian user not appended.JPG ‏260 KB
    julian user appended.JPG ‏257 KB
    galil mc USER rotation w File writing 5-16-14.vi ‏251 KB

  • Searching a text file and printing the line if found!

    Hi, Im fairly new to JAVA and have been googling this for hours and havent found any results that
    have helped me...
    Im looking to search a text file for a value that is in a that is delimited by colons
    eg 45787 : 398948 : 398884 : 398984
    IF that value is found I need to print this entire line and move it into a string.
    I can work out the delimit part, the problem for me is a)searching the text file
    and b) tell java to print that line only??
    Any help would be very very much appreciated
    Cheers
    James

      public void printCourses() throws Exception
                stuinput[] courseObjArray = new stuinput[10]; //Make sure this is the same as the ammount in the text
                   Scanner sc = new Scanner(new File("testfile.txt"));
                   int i=0;
                   boolean found = false;
                   while(sc.hasNextLine())
                   //Delimit this line with scanner
                   Scanner sc1 = new Scanner(sc.nextLine());
                   sc1.useDelimiter(":");
                   courseObjArray[i] = new stuinput(sc1.next(),sc1.next());
                   i++;
                   }//while
                   for(int i1 = 0;i1 < courseObjArray.length;i1++)
                   System.out.println(courseObjArray[i1].courseCode);
                   System.out.println(courseObjArray[i1].courseName);
                   System.out.println(courseObjArray[i1].courseName);
                   System.out.println("-----------------");     
                   String courseCode2 = "courseObjArray[i1].courseCode";
                   if (courseCode2  == "12345")
                        System.out.println("working");
                   else{System.out.println("Not Found");}
           }hmmm just wondering why could this method always return a "Not Found"....if the text file had a whole bunch of values like this
    12345:Course1
    12344:Course2
    12343:Course3
    isnt it surposed to return 1 "Working"?? because there is a 12345 in on of the line, in the semi colon delimited line with 2 values, one being the course code, one being the course name??
    Given that there is 10 lines (from Array Object)

  • Is there a function to Search a Text File?

    I am writing a program that will read data from a URL and then save that URL to a text file. I then need to be able to search the text file for certain strings and must know which line they appear on. I realize that I could read the text file in line by line looking for the string and then note the current line number. However, I need to search for 20-30 different strings in each URL and this would be very inefficient. I would really like some way to say:
    int lineNumber = 0;
    lineNumber = searchText("sometextfile.txt", str);
    And have searchText return the lineNumber on which the String str was found. Alternately, if there is way to search a URL that would cut out the middle man of writing it to a text file first.
    Any help would be greatly appreciated as I could not find this anywhere. Thanks.

    I have done something similar to to this, but it depends on what you want to use it for. I was looking for specific data on websites and would copy that data into a database. So, I used regex to find the data on the site and copy it. I also had to use String Tokenizer in certain places to get the correct data sometimes.
    orozcom

  • How to Run a text files using UNIX

    Hi,
    I have 10 text files in my project my task is to load all the text files data into Relational Database so i can use sql*loader to load all the text files data into a Database.
    but the thing is another project i have 200 text files so i need to run these text files using UNIX script could anyone tell me how to load all the text files using UNIX
    Thank's
    Edited by: Lavanya on Sep 5, 2012 3:09 PM

    Lavanya,
    This question relates to shell scripting and in IMO it is not an oracle question.
    I have made some initial assumptions before my proposed solution.
    PLEASE note that this is untested, but can just guide you as a template for solving your problem.
    Assuming that you have properly set up the control file and mapped each and every table in it as per the file information which you have..
    Assuming the text file to be in the format of : ------ (as suggested by other posters earlier, this file holds instructions about the file and table mapping which shall be used by your sqlldr process.)
    tmp.txt:
    text_file_1-------------should goes to----customer_info_table
    text_file_2------------should goes to------customer_address_table
    text_file_3-----------should goes to-------customer_order_table
    while read line
    do
    SQLLDR CONTROL=`echo $line | sed 's/should goes to/ /g' | sed 's/-//g' | awk -F " " '{print $1}'`.ctl,
    LOG=`echo $line | sed 's/should goes to/ /g' | sed 's/-//g' | awk -F " " '{print $1}'`.log,
    BAD=`echo $line | sed 's/should goes to/ /g' | sed 's/-//g' | awk -F " " '{print $1}'`.bad,
    DATA=`echo $line | sed 's/should goes to/ /g' | sed 's/-//g' | awk -F " " '{print $1}'`.txt
    USERID=scott/tiger
    done <tmp.txtAll I am trying to run from the above shell script is : -- PLEASE TEST it if it matches your requirement.
    SQLLDR CONTROL=text_file_1.ctl, LOG=text_file_1.log, BAD=text_file_1.bad, DATA=text_file_1.txt USERID=scott/tiger
    SQLLDR CONTROL=text_file_2.ctl, LOG=text_file_2.log, BAD=text_file_2.bad, DATA=text_file_2.txt USERID=scott/tiger
    SQLLDR CONTROL=text_file_3.ctl, LOG=text_file_3.log, BAD=text_file_3.bad, DATA=text_file_3.txt USERID=scott/tigerRepeating my assumptions, I assume you have all those files required for SQLLDR process to run (ctl file, data file...)
    Cheers,
    Manik

  • Search for a word and return all the  lines (row) from the text file..

    Hi all,
    I need a help on how to search a string from the text file and returns all the lines (rows) where the searched string are found. I have included the code, it finds the indexof the string but it does not return the entire line. I would appreciate your any help.
    public class SearchWord
         public static void main(String[] args){
         //Search String
         String searchText = "man";
         //File to search (in same directory as .class file)
         String fileName = "C:\\Workspace\\MyFile.txt";
         //StringBuilder allows to create a string by concatinating
         //multiple strings efficiently.
         StringBuilder sb =
         new StringBuilder();
         try {
         //Create the buffered input stream, which reads
         //from a file input stream
         BufferedInputStream bIn =
         new BufferedInputStream(
         new FileInputStream(fileName));
         //Holds the position of the last byte we have read
         int pos = 0;
         //Holds #of available bytes in our stream
         //(which is the file)
         int avl = bIn.available();
         //Read as long as we have something
         while ( avl != 0 ) {
         //Holds the bytes which we read
         byte[] buffer = new byte[avl];
         //Read from the file to the buffer
         // starting from <pos>, <avl> bytes.
         bIn.read(buffer, pos, avl);
         //Update the last read byte position
         pos += avl;
         //Create a new string from byte[] we read
         String strTemp =
         new String(buffer);
         //Append the string to the string builder
         sb.append(strTemp);
         //Get the next available set of bytes
         avl = bIn.available();
         catch(IOException ex) {
         ex.printStackTrace();
         //Get the concatinated string from string builder
         String fileText = sb.toString();
         int indexVal = fileText.indexOf(searchText);
         //Displays the index location in the file for a given text.
         // -1 if not found
         if (indexVal == -1)
              System.out.println("No values found");
         else
              System.out.println("Search for: " + searchText);     }
    }

    Hi, you can use servlet class and use this method to get the whole line of searched string. You can override the HttpServlet to treat that class as servlet.
    public class ReportAction extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    //write your whole logic.
    BufferedReader br = new BufferedReader(new FileReader("your file name"));
    String line = "";
    while(line = br.readLine() != null) {
        if(line.contains("your search string")) {
            System.out.println("The whole line, row is :"+line);
    }

  • I was given an assingment, but have no idea where to begin. The assingment is to create a text file using notepad with all of my digital inputs and some how make those imputs show up on my digital indicators on my control pannel

    I was given an assingment, but have no idea where to begin. The assingment is to create a text file using notepad with all of my digital inputs and some how make those imputs show up on my digital indicators on my control pannel.
    When it was explained to me it didn't sound to hard of a task, I have no LabVIEW experience and the tutortial sucks.

    StevenD: FYI, I did NOT give you the one star rating. I would never do that!
    StevenD wrote:
    Ow. Someone is grumpy today.
    Well, this is an assignment, so it is probably homework.
    Why else would anyone give HIM such an assigment, after all he has no LabVIEW experience and the tutorials are too hard for him?
    This would make no sense unless all of it was just covered in class!
    This is not a free homework service with instant gratification.
    OK! Let's do it step by step. I assume you already have a VI with the digital indicators.
    "...but have no idea where to begin".
    open notepad.
    decide on a format, possibly one line per indicator.
    type the document.
    close notepad.
    open LabVIEW.
    Open the existing VI with all the indicators.
    (are you still following?)
    look at the diagram.
    Who made the program?
    Does the code make sense so far?
    Is it a statemachine or just a bunch of crisscrossed wires?
    Where do you want to add the file read?
    How should the file be read (after pressing a read button, at the start of the program ,etc.)
    See how far you get!
    Message Edited by altenbach on 06-24-2008 11:23 AM
    LabVIEW Champion . Do more with less code and in less time .

  • How to display the out put of the sql query in a text file using forms

    I want to display the out put of the sql query in a text file using forms 6.0.Same could be done using spool command in sqlplus but i want it using forms....Fiaz

    Have a look at the text_io package:
    http://www.oracle.com/webapps/online-help/forms/10g/state?navSetId=_&navId=3&vtTopicFile=f1_help/oraini/c_text_io.html&vtTopicId=
    cheers

  • Report the size of all SharePoint Databases in a text file using PowerShell?

    I am new to Powershell. please help me for following question with step by step process.
    How to report the size of all SharePoint Databases in a text file using PowerShell?

    Hi Paul,
    Here is the changed script, which will also include the size for the Config DB.
    Please let me know if it worked:
    #Get SharePoint Content database sizes
    Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
    $date = Get-Date -Format "dd-MM-yyyy"
    #Variables that you can change to fit your environment
    $TXTFile = "D:\Reports\SPContentDatabase_$date.txt"
    $SMTPServer = "yourmailserver"
    $emailFrom = "[email protected]"
    $emailTo = "[email protected]"
    $subject = "Content & Config Database size reports"
    $emailBody = "Daily/Weekly/Monthly report on Content & Config databases"
    $webapps = Get-SPWebApplication
    $configDB = Get-SPDatabase | ?{$_.Name -eq ((Get-SPFarm).Name)}
    $ConfigDBSize = [Math]::Round(($configDB.disksizerequired/1GB),2)
    Add-Content -Path $TXTFile -Value "Config Database size: $($ConfigDBSize)GB"
    Add-Content -Path $TXTFile -Value ""
    foreach($webapp in $webapps)
    $ContentDatabases = $webapp.ContentDatabases
    Add-Content -Path $TXTFile -Value "Content databases for $($webapp.url)"
    foreach($ContentDatabase in $ContentDatabases)
    $ContentDatabaseSize = [Math]::Round(($ContentDatabase.disksizerequired/1GB),2)
    Add-Content -Path $TXTFile -Value "- $($ContentDatabase.Name): $($ContentDatabaseSize)GB"
    if(!($SMTPServer) -OR !($emailFrom) -OR !($emailTo))
    Write-Host "No e-mail being sent, if you do want to send an e-mail, please enter the values for the following variables: $SMTPServer, $emailFrom and $emailTo."
    else
    Send-MailMessage -SmtpServer $SMTPServer -From $emailFrom -To $emailTo -Subject $subject -Body $emailBody -Attachment $TXTFile
    Nico Martens - MCTS, MCITP
    SharePoint 2010 Infrastructure Consultant / Trainer

  • How to read the last line in a text file using text_io?? please help

    Dear all
    I made a procedure that append text into a text file on the operating system.
    the text file grows rapidly. It contains now about 200,000 line . I need to read the last line only . In other wprds i need to go direct to the last line to read some values. Is it possible??
    Please help

    Hello,
    If you know the number of the line you want to read, I can sugget you to use the MORE dos command or the TAIL unix command that redirect to a temporary text file
    Example to create a file that contains the 200010th last lines :
    (Client)Host( 'MORE the_file_name.txt +200010 > small_file.txt') ;So you have only to read the small file with the TEXT_IO functions.
    Francois

  • How to only read the last line in the text file by using BufferedReader ?

    Dear all,
    Hello, I am new to Java. Do anybody know how to read the last line (this is the last record) in the text file.The method I am now using is reading from the first line until I reach the last line in the text file. Thank you!!
    BufferedReader br = new BufferedReader(new FileReader("c:\\sdk1.4.1\\bin\\dbExport.txt"));
    DataInputStream in = new DataInputStream(new FileInputStream("c:\\sdk1.4.1\\bin\\dbExport.txt"));
    String input;
    String firstinput;
    String secondinput;
    int count=90;
    int year=1955;
    while ((input = br.readLine()) != null) {
    firstinput = input.substring(0, 10);
    secondinput = input.substring(10);
    String insertStore1 = ("INSERT INTO AUTHORS " +
    "VALUES ('" + count + "', '" + firstinput + "', '" + secondinput + "', 1955)");
    System.out.println(insertStore1);
    int result = stmt.executeUpdate(insertStore1);

    I suppose you could use a java.io.RandomAccessFile.

  • Add a line to end of the file using VBscript

    HI
    I am working with a software that only accept Vb script commands.
    I have a file that has 8 columns. I need to add a line at the end of the file using VB script
    I need this line to add numbers of amount column and put 22 in 7th column and leave the rest empty.
    example:
    2.01E+13
    77008900
    9.88
    6/3/2013
    1/14/2014
    1/17/2014
    2.01E+13
    77008900
    66.07
    6/5/2013
    1/14/2014
    1/17/2014
    added line
    66.07+9.88=75.95                                               
    22
    the files have different number of rows. please help

    why in the word you think you are smart as the fact is that you don't know shit.
    I explained to you that the software has the ability to edit the file using VBscript. Now if you cant do it dont say that it makes no sense. because others already help me to solve this.
    do everyone a favor and don't answer my questions please, Well you never answered any, don't post any nonsense comments
    I am sorry but I don't think any of us can understand what you are trying to ask.  What software?  VBScript is a scripting language that you use to write a script.  It cannot modify a file that is open by another process.
    We posted the suggestion to look into using the FileSystemObject to append a line to a file.  The examples show you how to do this.
    I suspect that the real problem is that, since you don't speak English natively, we are not understanding what you are trying to ask.  I know that, for me, what you are asking doesn't make sense. Another guess is that you have a program that is able
    to use VB to do things.  Is that what you mean by "softwares".  Are you saying that another program is written in VBScript and you want to modify it?
    You have to clarify these things.
    ¯\_(ツ)_/¯

Maybe you are looking for

  • Parallel Process Model vs Asynchrono​us Sequence

    I've been studying the features of TestStand, and learning how to use it for about a month, so still very new to the environment (although I have been using Labview and Veristand pretty heavily for about a year).  I wanted to get a little clarificati

  • Convert from Single Org to Multi-Org

    Hi All, Can someone tell me what are the steps to convert from Single Org to Multi-Org ? Is it only the profile value 'MO: Operating Unit' to be setup ? or any other steps to be setup ? Regards Jhansi

  • Survey link is not available

    Hi Friends, In WEB UI the survey link is not appearing . please find the snapshot o the error and guide through. Regards Sumit

  • Does any app exist to track the history of iphone

    is there any app which can track the history of the apps opened or used in the iphone ?

  • Zoom images in a project

    Hi everyone, I have an project that when you enter a certain number and click a ''enter'' button, it send you to an image (forest picture, desert picture, town picture, etc). In these pictures, I've hidded some object. In exemple, in the forest pictu