How to delete a character at the end of each line in a file

Hi
How to remove a character or symbol at the end of each line in a file?
I am having a file with every end of line conatins special chars @.
I need to remove or delete that sysmbol from file.
Regards

JoeBorland wrote:
File is large about above 20,000 lines.
I need to find the optimum solution.
Like reading a file and find the end of character and writing into a file.
The above way is correct or any other way?Try it and see. Such a program will only be a dozen lines long.

Similar Messages

  • Adding a pipe character '|' at the end of each line

    How can I add a '|' at the end of each line in a text file?
    Please provide an example.
    TIA

    Using Readers and Writers are often a better choice for text: they are designed for character-based I/O, handling different character set encodings and thus more easily localizable.
    BufferedReader and PrintWriter are buffered which in many cases will increase performance.
    These classes also provide line-oriented methods, readLine() and println(), which will handle end-of-line delimiters in a platform-independant way.
    BufferedReader in = null ;
    PrintWriter out = null ;
    try {
        in = new BufferedReader(new FileReader("infile.txt")) ;
        out = new PrintWriter(new FileWriter("outfile.txt")) ;
        String line ;
        while ((line = in.readLine()) != null) {
            out.print(line) ;
            out.println('|') ;
        out.flush() ;
    } catch (FileNotFoundException e) {
        System.err.println("problem opening file for read: "+e) ;
    } catch (IOException e) {
        System.err.println("problem reading file: "+e) ;
    } finally {
        try {
            if (out != null) out.close() ;
            if (in  != null) in.close() ;
        } catch (IOException e) {
            System.err.println("problem closing files: "+e) ;
    }

  • How to remove # from the end of each lines of .csv file.

    Hi ,
    I have uploaded .csv file from my local m/c (windows) to application server (unix) thru. FM 'ARCHIVFILE_CLIENT_TO_SERVER'
    Issue is when I open the file in AL11 it is showing # at end of each line. Click below link to see the output file.
    [https://docs0.google.com/document/edit?id=1PzjhljdCC2Wgj9L1dZ51G4pHJ0G_7jJwQAMqcJHdggc&hl=en#]
    Pls. help me how to remove all the # from the file.
    Thanks in advance.
    Devinder

    Hi ,
    use this
    Declare this 
    that # value is actually use of   Tab in file 
    so in order to remove that  use below code 
    DATA :C_TAB(1) TYPE c VALUE   cl_abap_char_utilities=>HORIZONTAL_TAB .
    loop at it_data .
    refno = it_data-line .
    REPLACE ALL OCCURRENCES OF c_tab IN refno WITH ''.
    modify it_data .
    endloop.
    Regards
    Deepak.

  • Is it possible to export to PDF without a Return character at the end of every line?

    I am the author of a book whose first edition has been typeset and extensively amended in InDesign.  I now need to rewrite the first edition to produce a second edition.
    When I copy-and-paste from the PDF with which the publisher has supplied me into MS Word, I get a Return character at the end of every line, which means that text doesn’t automatically wrap and sentences are fragmented so that I get spurious grammar errors.
    I know that not all PDF files have a Return at the end of every line.  Is it possible to restrict Returns to the end of paragraphs when exporting from InDesign to PDF?  If so, what should the publisher be asking the typesetter to do?

    Thanks for your lightning-swift and helpful replies, Mike & Ellis.
    I don't have InDesign myself, so I know hardly anything about how it's used.  I'm just trying to research what an internationally-known publisher should already know how to do, but apparently doesn't!
    Following your suggestion, Mike, I have downloaded the trial version of Acrobat and exported the PDF to a Word file.  This has been moderately successful as there are far fewer spurious Return characters, just a few that I suspect may be hangovers from the typesetter having introduced soft returns in ID.
    As you've suggested Peter and Ellis, I'll suggest that the publisher asks the typesettter to export from ID to RTF and Text to see if that's even better.
    Message was edited 15:24 GMT by: AlanS5100

  • How to add a signature at the end of each post

    How do you add a signature at the end of each post (if possible)?
    ^^right now, I just have to copy and paste that

    It's possible to set up your signature on the Desktop such that it can be simply dragged into the Camera icon's "From the Web" field...
    1. Right click on an already posted pic
    2. Choose "Open Link in New Tab"
    3. From the address bar of that new tab, drag the URL's favicon (little icon) to your Desktop whereupon an "@" icon will be created
    The above only has to be done once, and then to use that image in future posts...
    1. Click the Camera icon
    2. Click "From the Web"
    3. Drag the URL's "@" icon from your Desktop to the URL field and click Insert Image
    And if you want your signature instead of a generic "@" icon, that's possible too:

  • How can I eliminate automatic "quotation marks" that are appearing at the end of each line?

    I keep getting "quotation marks" at the end of every line when I type. How can I eliminate these marks as they are even showing up when I print and I will not have on my wedding programs! Please help (from a desperate bride-to-be)!

    It sounds like you are using an East Asian font and unless you are issuing invitations in Chinese, Japanese, or Korean that doesn't sound like a good idea.
    Peter

  • How to add a character at the end of an array element that meets certain criteria.

    Hi. I am using CF 9.2.1. I started learning CF yesterday, and I am trying to figure out a way to add a special character (like "?", "!"," & ") to an array row if the first row element (say, element [1][1]) has a specific letter like " t" in the word it is holding. In this case the special character will be added at the end of the last row element (element [1][3]).
    Example: The take columns are: "Firstname", "Lastname", "Age".  If Firstname contains an "s" or "S" (in any order) then add "!" at the end of the row so that :
    Sam, Rubins, 26 !
    Nick, Palo, 32
    Robert, Williams, 28
    Oscar, Ramirez, 23 !
    I tried using the ReReplace, Refind and the #findoneof functions. I could probably loop through the array and return a value and store, while storing the value in a separate variable and using an if/Boolean function to compare that value and so on.... But I am sure there's an easier and more efficient way. Thanks in advance.
    <!--- #1 I will create a three column query named CityInfo--->
    <cfset CityInfo = QueryNew("City, State, LCode","VarChar, VarChar, Integer")>
    <cfset newRow = QueryAddRow(CityInfo, 2)>
    <cfset newRow = QueryAddRow(CityInfo, 3)>
    <cfset newRow = QueryAddRow(CityInfo, 4)>
    <cfset newRow = QueryAddRow(CityInfo, 5)>
    <cfset newRow = QueryAddRow(CityInfo, 6)>
    <!---Using the column names City, Sate and LCode I will now enter the information--->
    <cfset temp = QuerySetCell(CityInfo, "City", "Dallas", 1)>
    <cfset temp = QuerySetCell(CityInfo, "State", "TX", 1)>
    <cfset temp = QuerySetCell(CityInfo, "LCode", "214", 1)>
    <cfset temp = QuerySetCell(CityInfo, "City", "Fort Worth", 2)>
    <cfset temp = QuerySetCell(CityInfo, "State", "TX", 2)>
    <cfset temp = QuerySetCell(CityInfo, "LCode", "817", 2)>
    <cfset temp = QuerySetCell(CityInfo, "City", "San Antonio", 3)>
    <cfset temp = QuerySetCell(CityInfo, "State", "TX", 3)>
    <cfset temp = QuerySetCell(CityInfo, "LCode", "210", 3)>
    <cfset temp = QuerySetCell(CityInfo, "City", "L.A.", 4)>
    <cfset temp = QuerySetCell(CityInfo, "State", "CA", 4)>
    <cfset temp = QuerySetCell(CityInfo, "LCode", "213", 4)>
    <cfset temp = QuerySetCell(CityInfo, "City", "Austin", 5)>
    <cfset temp = QuerySetCell(CityInfo, "State", "TX", 5)>
    <cfset temp = QuerySetCell(CityInfo, "LCode", "512", 5)>
    <h4> Number1. City info TABLE contents:</h4>
    <cfoutput query = "CityInfo">
    #City# #State# #LCode#<br>
    </cfoutput> 
    <!--- #2 Now I focus on the array. I declare it first --->
    <cfset cityarray=arraynew(2)>
    <!--- Then I retrieve the data and populate the array --->
    <cfloop query="CityInfo">
    <cfset cityarray[CurrentRow][1]=City>
    <cfset cityarray[CurrentRow][2]=State>
    <cfset cityarray[CurrentRow][3]=LCode>
    </cfloop>
    <h4>Number2. City info ARRAY contents before appending:</h4>
    <cfloop index="Counter" from=1 to=5>
    <cfoutput>
    City: #cityarray[Counter][1]#,
    Estate: #cityarray[Counter][2]#,
    Code: #cityarray[Counter][3]#<br>
    </cfoutput>
    </cfloop>
    <!--- #3 I now add/append Irving to the array and change L.A. --->
    <cfset cityarray[6][1] = "Irving" />
    <cfset cityarray[6][2] = "Texas" />
    <cfset cityarray[6][3] = "972" />
    <cfset cityarray[4][1] = "Los Angeles" />
    <h4>Number3. City info Array contents after adding Irving, TX and updating L.A.:</h4>
    <cfloop index="Counter" from=1 to=6>
    <cfoutput>
    City: #cityarray[Counter][1]#,
    Estate: #cityarray[Counter][2]#,
    Code: #cityarray[Counter][3]#<br>
    </cfoutput>
    </cfloop>
    <br>
    <!--- #4 now I look for the 's' in order to add a '!' THIS IS WHERE MY PROBLEM BEGINS --->
    <h4>Number4. City info after searching for "s"</h4>
    <cfloop index="Counter" from=1 to=6>
    <cfoutput>
    City: #cityarray[Counter][1]#,
    Estate: #cityarray[Counter][2]#,
    Code: #cityarray[Counter][3]#,
    <!--- I know the findoneof function is not going to help me, but I hope it helps to give you an idea of what I am trying to do--->
    #findoneof("sS",cityarray[Counter][1])#
    <br>
    </cfoutput>
    </cfloop>

    It is much simpler than you think. Additions and modifications are in italics. Good luck!
    <h4>Number2. City info ARRAY contents before appending:</h4>
    <cfloop index="Counter" from="1" to="#CityInfo.recordcount#">
    <cfoutput>
    City: #cityarray[Counter][1]#,
    State: #cityarray[Counter][2]#,
    Code: #cityarray[Counter][3]#<br>
    </cfoutput>
    </cfloop>
    <!--- #3 I now add/append Irving to the array and change L.A. --->
    <cfset cityarray[6][1] = "Irving" />
    <cfset cityarray[6][2] = "Texas" />
    <cfset cityarray[6][3] = "972" />
    <cfset cityarray[4][1] = "Los Angeles" />
    <h4>Number3. City info Array contents after adding Irving, TX and updating L.A.:</h4>
    <cfloop  index="Counter" from="1" to="#arrayLen(cityarray)#">
    <cfoutput>
    City: #cityarray[Counter][1]#,
    State: #cityarray[Counter][2]#,
    Code: #cityarray[Counter][3]#<br>
    </cfoutput>
    </cfloop>
    <br>
    <!--- #4 now I look for the 's' in order to add a '!' THIS IS WHERE MY PROBLEM BEGINS --->
    <h4>Number4. City info after searching for "s"</h4>
    <cfloop index="Counter"  from="1" to="#arrayLen(cityarray)#">
        <cfset sPosition=findNoCase("s",cityarray[Counter][1])>
        <cfoutput>
        City: #cityarray[Counter][1]#,
      State: #cityarray[Counter][2]#,
        Code: #cityarray[Counter][3]#
        </cfoutput>
       <cfif sPosition GT 0><!--- Just display the exclamation mark--->
        <cfelse> <!--- Add whatever you like, or nothing, here--->
        (no 's')
        </cfif>
        <br>   
    </cfloop>

  • Getting weird symbols end the end of each line in Action script panel . Please help!!!!

    Let me know if anybody have got any clue to resolve this issue

    In the far upper right of the Actions panel is a small menu icon.  That includes the option for the menu-based route to turning the hidden characters on and off in case it ever happens again and you can't find this posting to help recall it.

  • BOX character at the end of line when file transferred from SAP to  WINDOWS

    Hi,
    We have a file interface program which creates a comma seperated '.txt' file in application server. Once it is created in application server in provided path an UNIX script runs which transfers this file from SAP application server to a network drive in WINDOWS platform. This file looks fine  when opened through WINSCP from SAP application server but when checked the file in network drive opened with note pad, it found each line come at the end of another line seperated by 'BOX' character.
    If we opened the file in word pad instead of note pad it looks fine.
    If any one of you have any idea to resolve this issue it will be a great help.
    Thanks,
    Ranadev

    Hi Ranadev,
    This happens because when you transfer the file to the Windows platform using the UNIX script it removes uses only a newline character at the end of each line instead of the Windows platform standard which is carriage return/newline.  The Notepad program displays this character alone as the box that you see.  If you want to verify take the same program and convert to Windows format using Notepad++ and you'll see that the same file then displays properly in Notepad.
    Regards,
    Ryan Crosby

  • Character # at the end of file in transaction AL11

    Hi gurus,
    In version 46c if I upload a file to application server with program RC1TCG3Z and in mode BIN when I display the file with transaction AL11 the file is correct.
    In version 60 if I upload a file to application server with the same program and in mode BIN when I display the file with transaction AL11 appears character # at the end of some lines. How it is possible?
    Thanks,

    Hi,
    U need to use one class. Refer below given code.
    TYPES : BEGIN OF lt_record_input,
              rec(1000) TYPE c,
            END OF lt_record_input.
    DATA : li_record_input TYPE TABLE OF lt_record_input .
    DATA lv_cr TYPE c.
    lv_cr = cl_abap_char_utilities=>cr_lf.
    CONCATENATE '/opt/isv/cti_app/DOCU/INCOMING/PROCESSED/UNSUCCESSFUL/'
    gv_filename INTO lv_path.
    OPEN DATASET lv_path FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    IF sy-subrc = 0.
      DO.
        READ DATASET lv_path INTO lw_record_input-rec.
        IF sy-subrc EQ 0.
          REPLACE lv_cr IN lw_record_input-rec WITH space.
          APPEND lw_record_input TO li_record_input.
        ELSE.
          EXIT.
        ENDIF.
      ENDDO.
      CLOSE DATASET lv_path.
    ENDIF.
    Hope it help u.

  • Character # at the end of line with transaction AL11

    Hi gurus,
    In version 46c if I upload a file to application server with program RC1TCG3Z and in mode BIN when I display the file with transaction AL11 the file is correct.
    In version 60 if I upload a file to application server with the same program and in mode BIN when I display the file with transaction AL11 appears character # at the end of some lines. How it is possible?
    Thanks,

    > I don't have access to OS level.
    Check the file on OS level (ask the admin to copy that file), it may be a display issue in the GUI.
    Markus

  • How can I add a response to the end of each item question in an email list of questions and send that back to the originator?

    I have emails that ask for certian items to be addressed such as "please fix leak in bath sink" and then the next line will have another request and on and on. I would like to answer each question at the end of each line with a response (preferably in a different color font to stand out) such as "yes - will fix" or "that can't be done" or "you will have to fix that yourself". Then I want to send that reply back to the original sender.

    ''sfhowes [[#answer-697423|said]]''
    <blockquote>
    I suggest you consider this add-on: [https://addons.mozilla.org/en-US/thunderbird/addon/clippings/ Clippings] ([http://chrisramsden.vfast.co.uk/3_How_to_install_Add-ons_in_Thunderbird.html How to install]).
    </blockquote>
    I did look int this but I need to have each answer different in a lot of cases but i thank you and did get an answer that does help greatly - Thanks

  • Finding the end of a line in a JTextArea and inserting a comma

    Hi,
    At the moment I am reading in a comma delimited file into a JTextArea.
    This part is ok I can see the file in the window correctly.
    The problem that I am having now is that I want to add a comma to the end of each line in the JTextArea.
    Does anyone know how to do this?
    Thank you

    Well you have to get the String value of the JTextField.
    String text = YourJTextField.getText()
    Then you have to make a loop and check each single character if it equals '\n', that means "RETURN" or "NEW LINE".
    That is the direction I would go. Inform yourself about String manipulations first, like how to look for character, how to compare them and how to add them.

  • Reg. Special Character at end of each line

    Hello Experts,
    I have an internal table of type string which has to be uploaded into the directories
    Each line has to be ended with a comma and for which I concatenated the work area and ',' before appending to the internal table.  This is fine till this point.
    After downloading the file from the directory, when opened with a notepad, i could see a special character (LINE FEED rectangular box) at the end of each line. 
    I couldn't understand why this character got appended at the end of each record.  Pl suggest me on how i can overcome this special character.
    Thanks
    RK

    Hi,
    I am developing one HRMS report for sending salaries to bank. Bank has given one format, there should be 24 spaces at the end of each line in the report. But I am not getting any spaces in the report at the end of line. I have tried soo many ways to get that, but I unable to get spaces. If I put any character it is coming, but if I put space that is not coming. For the line that is set the height of the Repeating Frame long enough to have the blank space. Vertical Elasticity should be expand.
    Also you can try by setting the property *"Vert. Space between frames"* for the Repeating frame.
    Hope this helps.
    Best Regards
    Arif Khadas

  • Space at end of each line in the RDF report.

    Hi All,
    I am developing one HRMS report for sending salaries to bank. Bank has given one format, there should be 24 spaces at the end of each line in the report. But I am not getting any spaces in the report at the end of line. I have tried soo many ways to get that, but I unable to get spaces. If I put any character it is coming, but if I put space that is not coming.
    Anyone please tell me how to get spaces at end of each line in RDF report. Its urgent guys...... Anyone please help me out.
    Thank you,
    Phani

    Hi,
    I am developing one HRMS report for sending salaries to bank. Bank has given one format, there should be 24 spaces at the end of each line in the report. But I am not getting any spaces in the report at the end of line. I have tried soo many ways to get that, but I unable to get spaces. If I put any character it is coming, but if I put space that is not coming. For the line that is set the height of the Repeating Frame long enough to have the blank space. Vertical Elasticity should be expand.
    Also you can try by setting the property *"Vert. Space between frames"* for the Repeating frame.
    Hope this helps.
    Best Regards
    Arif Khadas

Maybe you are looking for