[Help] Need help to remove a string in the text file

Hi all

I have a text like this

REPORT

Wednesday, June 10, 2015 14:31:56

**********************************************************************************

HOST: 10.9.1.185

TestVM is turned off

**********************************************************************************

HOST: 10.9.0.84

All virtual machines are turned off

**********************************************************************************

HOST: 10.9.0.85

**********************************************************************************

HOST: 10.9.0.86

I want to remove the

**********************************************************************************

HOST: 10.9.0.85

**********************************************************************************

HOST: 10.9.0.86

because there is no information after the HOST 10.9.0.85 or: 10.9.0.86

It will reduce the content of the report

I need a script to delete this text

Could someone help me?

Thank you for your help

What generates the report? It is probably easier to just do not write to the file in the first place...

Tags: VMware

Similar Questions

  • Need help: UTL_FILE read and write in the text file

    Hello, I'm on version 11 GR 2 by using the UTL_FILE function to read a text file and then write the lines where it starts with the word "foo" and put an end to my writing in the text file where the line with the word "ZEN". Now I have several lines that begin with 'foo' and 'ZEN' allow a paragraph, and in this paragraph, there is a line that begins with "DE4.2". Therefore,.
    I need to write all of the paragraphs that include the "DE4.2" line in their beginning and end of lines 'foo' and 'ZEN '.

    FOR EXAMPLE:

    FOO/234E53LLID
    IT'S MY SECOND LINE
    IT'S MY THIRD LINE
    DE4.2 IT OF MY FOURTH LINE
    IT'S MY FIFTH LINE
    ZEN/DING3434343

    FOO/234E53LLID
    IT'S MY SECOND LINE
    IT'S MY THIRD LINE
    IT'S MY FIFTH LINE
    ZEN/DING3434343

    I'm only interested in writing the first paragraph tha includes line DE4.2 in one of the paragraph of lines not the second ther that does not include the "DE4.2".

    Here is my code so far:

    CREATE OR REPLACE PROCEDURE my_app2 IS
    Utl_file.file_type INFILE;
    outfile utl_file.file_type;
    buffer VARCHAR2 (30000);
    b_paragraph_started BOOLEAN: = FALSE; -flag to indicate which required paragraph is started

    BEGIN
    -Open a file to read
    INFILE: = utl_file.fopen ('TEST_DIR', 'mytst.txt', 'r');
    -Opens a file for writing
    outfile: = utl_file.fopen ('TEST_DIR', "Out.txt", "w");

    -Check the file is open
    IF utl_file.is_open (infile)
    THEN
    -lines in the file in loop
    LOOP
    BEGIN
    UTL_FILE.get_line (infile, buffer);
    APPLICATION STARTING POINT-
    Buffer IF LIKE 'foo %' THEN
    b_paragraph_started: = TRUE;
    END IF;
    -SEARCH FOR GRADS APPS
    IF b_paragraph_started AND buffering LIKE '% 4% ' THEN
    UTL_FILE.put_line (outfile, buffer, FALSE);
    END IF;
    -REQUEST FOR ENDPOINT
    Buffer IF LIKE '% ZEN' THEN
    b_paragraph_started: = FALSE;
    END IF;
    UTL_FILE.fflush (outfile);

    EXCEPTION
    WHEN no_data_found THEN
    EXIT;
    END;
    END LOOP;
    END IF;
    UTL_FILE.fclose (INFILE);
    UTL_FILE.fclose (outfile);
    EXCEPTION
    WHILE OTHERS THEN
    raise_application_error ("-20099, ' UTL_FILE unknown error");
    END my_app2;
    /

    When I run this code I get only one line: DE4.2 it ME LACK THE WHOLE PARAGRAPH

    PLEASE ADVISE...

    I agree with reservations of Justin on the length of a "paragraph" and the number of users that are running at the same time, so here is a version without the collections.

    CREATE or replace PROCEDURE my_app2 IS
       infile utl_file.file_type;
       outfile utl_file.file_type;
       buffer VARCHAR2(30000);
       b_paragraph_started BOOLEAN := FALSE; -- flag to indicate that required paragraph is started
       b_toprint BOOLEAN := FALSE;
       l_para_start pls_integer;  -- start of "paragraph"
    BEGIN
       infile := utl_file.fopen('TEST_DIR', 'mytst.txt', 'r');
       outfile := utl_file.fopen('TEST_DIR', 'out.txt', 'w');
       LOOP
          BEGIN
             utl_file.get_line(infile, buffer);
             IF buffer LIKE 'FOO%' THEN
                b_paragraph_started := TRUE;
                l_para_start := UTL_FILE.FGETPOS(infile) - (length(buffer) + 1);
             END IF;
             IF b_paragraph_started and buffer like '%DE4%' THEN
                b_toprint := TRUE;
             END IF;
             If buffer like 'ZEN%' THEN
                IF b_toprint THEN
                   UTL_FILE.FSEEK(infile, l_para_start);
                   utl_file.get_line(infile, buffer);
                   while buffer not like 'ZEN%' loop
                      utl_file.put_line(outfile,buffer, FALSE);
                      utl_file.get_line(infile, buffer);
                   end loop;
                   utl_file.put_line(outfile,buffer, FALSE);
                end if;
                b_paragraph_started := FALSE;
                b_toprint := false;
                utl_file.fflush(outfile);
             end if;
          EXCEPTION
             WHEN no_data_found THEN
                EXIT;
             END;
       END LOOP;
       utl_file.fclose(infile);
       utl_file.fclose(outfile);
    END my_app2;
    

    Test:

    SQL> !cat mytst.txt
    FOO/234E53LLID
    THIS IS MY SECOND LINE
    THIS IS MY THIRD LINE
    DE4.2 THIS IS MY FOURTH LINE
    THIS IS MY FIFTH LINE
    ZEN/DING3434343
    
    FOO/234E53LLID
    THIS IS MY SECOND LINE
    THIS IS MY THIRD LINE
    THIS IS MY FIFTH LINE
    ZEN/DING3434343
    
    FOO/234E53LLID again
    THIS IS MY second SECOND LINE
    THIS IS MY second THIRD LINE
    DE4.2 THIS IS MY second FOURTH LINE
    THIS IS MY second FIFTH LINE
    ZEN/DING3434343 again
    
    SQL> exec my_app2;
    
    PL/SQL procedure successfully completed.
    
    SQL> !cat out.txt
    FOO/234E53LLID
    THIS IS MY SECOND LINE
    THIS IS MY THIRD LINE
    DE4.2 THIS IS MY FOURTH LINE
    THIS IS MY FIFTH LINE
    ZEN/DING3434343
    FOO/234E53LLID again
    THIS IS MY second SECOND LINE
    THIS IS MY second THIRD LINE
    DE4.2 THIS IS MY second FOURTH LINE
    THIS IS MY second FIFTH LINE
    ZEN/DING3434343 again
    

    You may need to change the length (buffer) + 1 depending on your platform and if you want a blank line s NLE out paragraphs, add another call to put_line after that outside of the loop in the fi l_toprint block.

    John

  • Write array of strings in the text file delimited by tabs without Report Generation Toolkit

    I find that writing in the File.vi worksheet does not Append REAL mode.  http://digital.NI.com/public.nsf/allkb/D1629D863F0442CC86256A0200558A15

    That url describes a workaround solution is to first create a file in Excel, save and then writing adds to it.  This is something that users of my compiled application will simply not do.

    Writing File.vi measure generates tab limited text files but only takes some input signals.

    I would take my array of strings and simply write that in a limited file tab.  Is there really no way to go in LabVIEW without spending $500 one another?


  • Need help to open two images with the same file with different exposures on the screen at the same time in the Photoshop creative cloud (in previous versions we could open two images of the same nef (raw) file and then combine them on the screen with the

    Need help to open two images with the same file with different exposures on the screen at the same time in the Photoshop creative cloud (in previous versions we could open two images of the same nef (raw) file and then combine them on the screen with the move tool. They have become a composite of two layers which could be developed further with the mask tool.

    Hello

    Please go to the preferences > workspace and uncheck the option 'open the document in the tabs '.

    Now you can click on file and choose file > open and open the two images in two different windows which can be arranged side by side.

    Thank you

  • Can all help with VI to get data (HEX) serial number and write in the text file

    Hello I am struggling with this problem for 2 months... They get help from different I thought I solved the problem, but of no use yet I stand on zero

    Problem: I need to get data on USB high speed HEXAGON shaped (coming in hexadecimal and be stored in the text file to the hexadecimal format as each hexadecimal value online different I'll also to attach the file)

    Get us ASCII on series or VISA read but when trying to convert to hex as shown in text file making it slower to deal with code, I know that my VI will have to improve more... I'm waiting for suggestions

    Need urgent help...

    Thanks in advance

    Hi Ali Afzal,.

    I think that the attached example can work for you. If not, then try the solution with sending the data to a parallel running the loop and store it there.

    Mike

  • Input string in the text through business rule beam

    Hello, I have a problem I can not enter a string in the text bar using the equation like membername = 'chain' or % membername % = @alias("January"); He entered nothing in the cell or replaces the existing value with #missing, on the other hand I can enter numbers here, but essbase interpreter number to a string. like 1 = Andy

    Essbase can store only numerical data and business rules are run on the essbase database.

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • Helps to replace a string in a txt file with a string from a csv file

    Hi all

    I worked on the script following since a few days now, determined to exhaust my own knowledge before asking for help... Unfortunately, it didn't take very long to exhaust my knowledge :-(

    Basically, I need to replace a value in a single file (raw.txt) with the value of another file (userids.csv) when a variable is. Then I released the results of a third file.

    To do this, I divided the "raw" file into variables using the ',' as the separator, the problem is that some variables are intentionally empty, where the fi $variable = "statements.

    It is currently what I want to do but only when the userids.csv file contains a single line. It is obviously because of the foreach ($user in import)... What I need to figure out is how to loop through the file raw.txt, text replacement when a variable in the user ID file is the text in raw.txt... I hope that makes sense?

    The user ID file is in the following format - user, service, Dept that can contain dozens of lines

    I would appreciate any pointers :-)

    See you soon

    # Treatment
    $importraw = get-content i:\raw.txt
    $import = import-csv i:\userids.csv-en-tete UserAccount, functional, Dept

    {foreach ($user in $import)
    $useraccount = $user. UserAccount
    $userfunction = $user. Functional
    $userdept = $user. Dept
    {foreach ($line in $importraw)
    $first, $second, $third, $fourth, $fifth, $sixth, $seventh, $eighth, $ninth = $line - split(",")
    $linesproc = $linesproc + 1
    If ($sixth - eq ") {}
    $temp6 = "6TEMP".
    Write-Host "field Null detected - assigning temporary value:"$temp6 ".
    $sixth = $temp6 # the assignment of a temporary value so that - statement to replace later works
    }
    If ($seventh - eq ") {}
    $temp7 = "7TEMP".
    Write-Host "field Null detected - assigning temporary value:"$temp7 ".
    $seventh = $temp7 # the assignment of a temporary value so that - statement to replace later works
    }
    If ($fifth - eq $user.) UserAccount) {}
    $line - $seventh, replace $user. Dept | Add content i:\Output.txt
    }
    else {}
    $line - $seventh, replace "/ / customer. Add content i:\Output.txt
    }
    }

    }

    Try the attached version.

    The problem, in my opinion, was in nested ForEach loops.

    Instead I've implemented with a lookup table

  • I need to permaneltly remove a choice in the search menu

    Hi, the other day I somehow ended up with two choices of yahoo in my choice of search bar. I unchecked the one with the exclamation point which is actually the homepage. I want to be able to delete it PERMANENTLY out of there you can give me instructions step by step? I feel really embarrassed by this... Thank you very much.

    I have attached a screenshot - this will explain everything.
    I know that I can ignore it, but it bothers me. I went into the subject: config to see what to do, but nothing helped.

    Help, please!

    Hello

    On Windows:

    • Go to C:\Program Files (x 86) \Mozilla Firefox\searchplugins
    • All you have to do is to delete the XML file for the search engine that you want to remove (e.g. google or yahoo) and restart Firefox.

    Deleting the file may require administrator approval. Simply click continue if windows request.

    It will be useful.

  • Help with my computer! All the deleted files, including recovery! What's past and how to fix it?

    Hello. So a few days ago I restarted my computer. Literally restarted my computer (turn off then turn onn) because my shortcuts do not work (the .exe would not launch files). I restarted my computer, and when I click on the shortcut, he said that there was no such destination. Soon I relised all my files are gone. I restarted my computer and you press F8 so that I can back to factory State, but the recovery has not worked and now im stuck at the facility because it looks like this: there is no for files recovery. Idk what happened but all my files and I installed software have disappeared. Someone can you please tell me what happened and how can I solve this problem?

    100% recovery does not work! Using the computer in safe mode doesn't work.

    My system doesn't have a backup of the files. The files just disappeared. All my files actually including the files for recovery. You say I should reinstall my windows using the CD/DVD. If this is the case, I have a problem because I don't have the CD/DVD for her. The paper in my computer box indicates that you must install it in the computer (deleted files). What can I do?

    Your system does not have backups of your files/folders for you.  It is your duty to implement only or not.  If you do not the installer / make backups of your data - so you lose if/when something happens.

    (The automatic backup of the system files needed) system restore is enabled by default - but can be disabled by the system administrator.

    The "recovery" you used is not a feature of Microsoft or setup - which was created by the computer manufacturer.  They decided that it would be more easy/better to put the backup of the system installation media in the same place the user puts all their stuff - on the physical hard disk in the machine.  It is destructive or not is determined by the computer manufacturer and they even included a choice (destructive or non-destructive recovery) _ at the time use you it.  Each of them has been/is different.

    You can contact the manufacturer of the computer and HOPE they always support of recovery for your computer and not you charge (or charge you a large part) to get the media said.

    Can read this - it might help:
    http://www.ZDNet.com/blog/Bott/lost-your-Windows-discs-how-to-get-replacement-media-legally/4320

  • equation of columns of values in the text file, please help

    I applied an equation to the to column values in a text file, thr is two columns; for every 10 values, I should get an output value, so a total of 5 values + 5 values for each of the two columns with values from 50.

    My vi don't wrk properly, the values are not justifiable, and I get only 5 values instead of 10 (5 for each of the 2 columns with 50 values)

    I have attached hv my vi, pls help.

    Of course, find NaN in there.  You are divided by 0.  Tip: The top 10 items are all 0.

  • Help, XP won't boot, missing the virtual file Disk.vmdk

    I am attaching a file "collect information of technical support.

    Don't know what happened, virtual disk of the virtual machine consists of 21 slices "Virtual Disk - s001.vmdk" through the "Virtual Disk - s021.vmdk", but a couple of these files are missing. Unless the files are still present in another folder (for example lost + found), or in the compartment of bits, then I'm afraid that only a recent backup will help.

    If you have any more of these files, it may still be possible to extract some files in the current hard files by replacing the missing files by dummy files.

    André

  • Please HELP ME.suddenly I care, all the text is converted into strange shapes. PLEASE HELP ME

    Today, all of a sudden my text in ae had real crazy, ALL the text in the ae is either typed as strange shapes, btw my version is a former ae cs3 is on but it never gave me any problems, I don't know how it happened, I cleared the cache and still notin happened.ive attached an image where I typed the entire alphabet without space... ND is became that... PLEASE HELP ME1.JPG

    Well, you have a pt 40 35 text px...

    Mylenium

  • Help - I'm trying to combine the 7 files in 1 PDF file, but failure message.

    I try to combine the 7 files into 1 PDF file. However, when I press the button to start the process of combination, I get a failure message.  Placing the cursor on the message reveals that the file is password protected.  What I am doing wrong? Basil.

    You cannot merge a file protected by password with other files. You have to

    First remove its protection.

    Monday, April 13, 2015 at 12:23, basiljackson [email protected]>

  • Help! With the help of event listener to trigger the text

    I use the following code to create the fast Word for a translator who made a direct translation of a cat.

    keyListener = new object()();

    keyListener. ( onKeyDown = function()(){ }

    if (Key. isDown (Key. CONTROL )){

    if (Key. isDown (51) ){

    txt. text = "Sarah says: ';

    }

    }

    }

    Key. addListener () keyListener ();

    keyListener = new object()();

    keyListener. ( onKeyDown = function()(){ }

    if (Key. isDown (Key. CONTROL )){

    if (Key. isDown (51) ){

    txt. text = ' Client says: ";"

    }

    }

    }

    Key. addListener () keyListener ();

    the word is correctly generated, only problem, it deletes all the text in the box of text as well. Is it possible to make a keyboard shortcut that doesn't only add this text on the same line I'm on?

    Otherwise I am also happy to settle for a button that generates this text as long as it does not remove the other text in the text box. any response would be appreciated.

    Thank you

    When you use =, it affects the value on the right to the variable (or text in this case) to the left. Try using +=. For example,.

    txt. Text = 'Hello '.

    txt. Text += "there." //would make "Hello there."

  • Remove an object from the XML file generated by PDF

    Hello

    In a step of the workflow user of my PDF, the user presses a submit button that sends XML data to an address. There is an image field that has hundreds of lines of XML code that does not need to send.  Indeed, at the time when this button is pressed "submit", the image field is already "hidden", but of course, it remains in the form.

    Is there an any access or visibility of goods which will remove an object enough that it is not transfer with XML?  How would you dynamically remove a field on the user-end?

    Hello

    One solution, use an ImageField object instead of an Image object. Then go to object > Binding palette and for binding, select without binding data (or none, depending on your version of the designer of the LC).

    Because you are currently using an ImageField you need one line of code to its event docReady (JavaScript):

    this.access = "readOnly";
    

    The lines in the XML data file contains the image to Base64 format.

    Hope that helps,

    Niall

Maybe you are looking for