Delete a line in the middle of a text file

Hi, I want to delete a certain string line in the middle of a text file. How could I do this? Thanks.

Got it. But instead of overwriting with spaces I only need to write the letter "b":
try {
                                        RandomAccessFile acceso=new RandomAccessFile("F:/ArchivoContrase�as.txt","rw");
                                        String linea="";
                                        while ((linea = acceso.readLine()) != null) {
                                                  StringTokenizer patron=new StringTokenizer(linea," ;");
                                                  String s=patron.nextToken();
                                                  s=patron.nextToken();
                                                  if (elimina.equals(s)) {
                                                       System.out.println(acceso.getFilePointer());
                                                       acceso.seek(acceso.getFilePointer());
                                                       acceso.writeBytes("b");                         
                                   } catch (FileNotFoundException e) {
                                        e.printStackTrace();

Similar Messages

  • Insert a blank line at the start of a text file

    I'd like to insert a blank line at the start of a text file.
    I presume SED would be the best to use? Any help on code would be greatly appreciated?

    Hi David,
       That is a little more difficult in sed and awk than it seems like it should be. I'll assume that you know how to handle the redirection and I'll just post the actual sed and awk commands. If you're comfortable with multiline statements in sed it could be done with the following:
    sed '1s/./\
    Programmatically more complicated but easier to type would be:
    sed '1{x;p;g;}'
       I think that it's conceptually simpler in awk using the BEGIN address like so:
    awk 'BEGIN{ print }//'
       You'll probably get other responses using other tools. I'm certainly curious to see what develops.
    Gary
    ~~~~
       "And I don't like doing silly things (except on purpose)."
          -- Larry Wall in <[email protected]>

  • HP J6480 All in one leaves a line down the middle of the paper.

    When I use the feed mode the printer squeeks and protest leaving a line down the middle of the paper.  How can I get this resolved

    Hi there billba,
    This article covers clearing a carriage jam and gives steps used in clearing the carriage assembly. Give the steps a shot and let us know if it helps. Though it seems the product may need servicing.
    Best of Luck!
    You can say thanks by clicking the Kudos Star in my post. If my post resolves your problem, please mark it as Accepted Solution so others can benefit too.

  • GUI_DOWNLOAD blank lines in the middle

    Hi All,
    I am using 'GUI_DOWNLOAD' FM to create excel file of my internal table data; Internal table is having 220 fields and expects to create 220 columns in excel file;
    In the middle of the excel file I get several blank lines on and off with only very few column values are filled;
    I checked the ITAB in debug before calling the FM it has no issues and has the correct data;
    My code is as below;
    CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = l_filename
          filetype                = 'ASC'
          write_field_separator   = 'X'
        TABLES
          data_tab                = i_compare
          fieldnames              = i_excel_head
        EXCEPTIONS
          file_write_error        = 1
    Appreciate your expert ideas please;
    Thank you
    Iver

    Hi,
    GUI_DOWNLOAD blank lines in the middle
    In your GUI_DOWNLOAD code, There is no mistake.
    I think, In your program, have you written any SET BLANK LINES ON.
    It is one case.
    Follow this link,
    http://wiki.sdn.sap.com/wiki/display/ABAP/DownloadinginternaltablestoExcel
    It may helps to you.
    Regards,
    Sekhar

  • Fuzzy line on the middle of display.

    Recently i have found a fuzzy line in the middle of my retina macbook pro screen (15"). I have always treated it very well, it never falled down.
    The line appear only with a strong light from sun, especially with dark backgounds on the screen.
    The line seams like dust, it's not like a crack. It has a lenght of 9cm long and an height of 1mm.
    I understand that the problem is probably related to how i used the mac, but i don't undertand the cause. The only thing have done is replacing the Spek cover, but two or three weeks before now. What do you think? Have I to replace the screen? How much does it cost?
    Hope you can help me.
    Olivum
    Sorry for my bad english

    Warranty is worldwide. He can take it to a Dutch Apple Store without worrying
    Best of luck.

  • My iPad has not been dropped or damaged at all. The screen is grey fuzzy and has coloured lines down the middle. iPad 3 also.

    My iPad has not been dropped or damaged at all. The screen is grey fuzzy and has coloured lines down the middle. iPad 3 also.

    Basics from the manual are restart, reset, restore.
    Try all of these.
    If these fail, then:
    iOS: Unable to update or restore

  • Grey line in the middle on the screen

    help a grey line in the middle of the screen

    Probably a hardware issue, it could be a failing display or graphics card. I'd recommend running Apple Hardware Test in Extended Mode 2-3x to see if it finds any errors. At some point you will need to make an appointment at  our local Apple Store or AASP for professional assesment.
    BTW please complete your profile, you can find the link under Your Stuff in the upper right of this screen. At the very least let us know the version of OS X on your computer and what computer you own.

  • Black line in the middle of the screen, I Pad is 2 years old, tried rebootng no change. Help!

    black line in the middle of IPad

    I am guessing when you say reboot, that you reset by holding the power button and home button until you saw the apple then let go. Did you try restoring it as new through iTunes on your computer? If you still have problems, you may want to make an appt with an Apple store.

  • I have a horizontal line across the middle of the ipod screen and the ipod and itunes won't sync.  What is the line and is it connected to the no sync.

    I have a horizontal line across the middle of the ipod screen and itunes and the ipod won't sync.  What is the horizontal line and is it connected to the no sync.

    Hey Dean Marvin,
    Thanks for the question. These two symptoms are probablyh related. To troubleshoot, let's try resetting your iPod:
    How to reset iPod
    http://support.apple.com/kb/HT1320
    Thanks,
    Matt M.

  • I have vertical lines in the middle of my screen

    have vertical lines in the middle of my screen

    Disabling "Automatic Graphics Switching" seems to work to resolve this problem if there are random lines that appear around windows and glitches in the display.
    System Prefs -> Energy Saver -> Disable automatic graphics switching
    Source:
    https://discussions.apple.com/message/23982751#23982751

  • When watching a video, often the Press Esc to return line in the middle of the screen does not disappear. What can I do to remove it?

    Often when watching a video, TV show on ABC or Hulu Plus, after going to the full screen, the Press Esc to return line in the middle of the screen does not disappear. What can I do to remove it so it does not detract from the viewing?

    Mac Pro - Mid 2010
    Processor  2 x 2.66 GHz 6-Core Intel Xeon
    Memory  8 GB 1333 MHz DDR3 ECC
    Graphics  ATI Radeon HD 5870 1024 MB
    Software  Mac OS X Lion 10.7.2 (11C74)
    This is a brand new machine that I just purchased from Apple. It was delivered yesterday
    The old computer is an old PowerMac G5, but my OS X install disc is a retail version of 10.5.
    I also tried the OS X 10.5 install disc that came with my MacBook Pro (2.6 Ghz Intel Core 2 Dual).
    Same issue - nothing but a grey screen when the system tries to boot from the DVD

  • I bought an iPad Mini on States 2 Months ago and yesterday i saw that the LCD have a black line in the middle can i use the warranty here on Power Mac Philippines ? Please Reply ASAP

    I bought an iPad Mini on States 2 Months ago and yesterday i saw that the LCD have a black line in the middle can i use the warranty here on Power Mac Philippines ? Please Reply ASAP

    Hi
    You should ask your relative to physically take the iPhone to the store rather than shipping it because as diesel vdub has said:
    "No Apple store will accept an iPhone shipped to them"
    All you have to do is safely pack and ship your iPhone from the Philppines to your California-based relative.
    HTH?
    Tony

  • Glowfilter sometimes adds a line across the middle of the bitmap

    I am using a glowfilter to draw the outline of a shape onto a bitmap.  I set both inner and knockout to true.
    Most of the time when I apply the filter, all goes well.  But sometimes, some of the shapes end up with a horizontal line across the middle.
    Does anyone have any idea what might cause this, and what workaround could be used to avoid it?

    Hey Dean Marvin,
    Thanks for the question. These two symptoms are probablyh related. To troubleshoot, let's try resetting your iPod:
    How to reset iPod
    http://support.apple.com/kb/HT1320
    Thanks,
    Matt M.

  • How can we delete a line from the table control .

    hi all
    how can we delete a line from the table control .
    situation is.
    created table control in se51 which will display the data of a table.
    how could i select a line from the table control ?
    how could i delete the selected lines form the table.
    thanks in advance

    Change the Table Control attributes such that user can only select a single record(row).
    <u>Tip to delete a selected record</u>
    1) write a module 'Mark' in the PAI as below
    PROCESS AFTER INPUT.
    MODULE cancel AT EXIT-COMMAND.
    LOOP WITH CONTROL table_view.
    MODULE read_table_control.
    FIELD flag MODULE mark ON INPUT.
    ENDLOOP.
    MODULE user_command_0100.
    2) Module Mark is below.
    MODULE mark INPUT.
    CHECK flag = 'X'.
    x = table_view-top_line + sy-stepl - 1.
    Delete itab INDEX x.
    ENDMODULE. " mark INPUT
    Table_view is the TableControl Name.
    'flag' is of type char(1) available in the Internal table which was assigned to the select option in the table control.
    <u>award if uesful</u>
    Regards,
    Sudheer

  • White screen with line down the middle?

    My Ipod hit the floor and now all I can see is a white screen with a line down the middle. Do I need to send it in for repair or is there something else I can do to get the screen to work? The music still plays however.

    Sounds like a hardware problem. I am not sure if you want to send it to Apple since they are likely to want to charge you almost the replacement cost of the iPod, that is if they will look at it at all.
    You might try some of the online iPod repair places. Many are pretty affordable.
    Patrick

Maybe you are looking for

  • Calling Web Service from PLSQL. Does anyone do this regularly?

    I grabbed the demo_soap package that is available on both metalink and on the regular oracle site, to try calling a web service from plsql to return the xml. I've had minor success, although I get an ORA600 error , for which I've opened up a TAR. How

  • Problems calling Java Servlets from HTML pages Online

    Hello I have created a Web site using Java Servlets, and have acquired some servlet enabled web-space however i am having some difficulty in calling the actual servlets from the HTML pages i was using the line of code as follows http://localhost:8080

  • Should I use Java?

    Hi all, I have a little VB6 experience, but I dont really know much about coding. I want to design a desktop application, you can almost call it payroll software, not big, just something basic to manage a few workers. Can I use Java for this purpose?

  • Printing is slow in adobe

    Greetings, We are having a large scale deployment issue with a new model Canon printer.  Printing is extremely slow when trying to print from Adobe. We have two different type of printers: Ricoh & Canon With Ricoh everything works great.  With Canon

  • Layoff pulldown problems from 23.98 DV timeline

    Every time I try to layoff my 23.98 DV timeline onto a miniDV tape, FCP seems to put in a 2:2:2:4 pulldown, no matter what i have the settings on. at least i assume it's a 2:2:2:4 pulldown. i check by laying off to tape using the Edit to Tape-Assembl