Text File Editing

sir i am having a text file but there is an unwanted junk data to be removed.it is at starting of the file
import java.io.*;
public class htmlpageparse
    public htmlpageparse()
        try
        StringBuffer str=new StringBuffer();
        String fileName="ser.dat";
        FileReader fr=new FileReader(fileName);
        BufferedReader br=new BufferedReader(fr);
        Writer fileWriter = new FileWriter ("ser2.dat");
       while(br!=null)
       fileWriter.write(br.readLine());
       fileWriter.write(br.readLine());
        catch(Exception e)
        e.printStackTrace();
public static void main(String arg[])throws Exception
    htmlpageparse h1=new htmlpageparse();
  but i am unable to remove the junk data contains a String Next
from there i want to extract data

String fileName="ser.dat"the name of the file suggests that you have a binary file.
you are trying to read it as if it contained text.
either make sure that the file indeed contains text or use the InputStream classes to read it.

Similar Messages

  • Export data into text file

    Hi all,
    I want to export table data into a delimeted text file with SQL*Plus.
    [edit]
    Sorry, non delimited text file
    [edit]
    Example:
    CREATE TABLE delim (
    col_a VARCHAR2(20),
    col_b VARCHAR2(40)
    value stored in
    col_a = FISH_1
    col_b = FISH_2
    spool x:\test_1.lst
    set feedback off;
    set HEADING off;
    set pagesize 0;
    set linesize 60;
    select col_a, col_b
    from table delim;
    spool off;
    =>
    FISH_1
    FISH_2
    When I now do the same with
    set linesize 62;
    the reslut is like this
    =>
    FISH_1 FISH_2
    In the output of the second example there is a blank between col_a and col_b.
    I have to export the column data without this one blank between columns.
    Is there any way to do this?
    Thanks and cheers,
    ben
    Message was edited by:
    ben512

    Well in your example there is one space between the two columns, anyway you can see in my previous example that there is a set colsep and that show what you want.
    But here is another example:
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SQL> create table test (
      2  col_a VARCHAR2(5),
      3  col_b VARCHAR2(3)
      4  );
    Table created.
    SQL>
    SQL> insert into test (col_a, col_b)
      2  values('abc', 'FA');
    1 row created.
    SQL>
    SQL> insert into test (col_a, col_b)
      2  values('def', 'KL');
    1 row created.
    SQL> insert into test values ('12345','123');
    1 row created.
    SQL> rem if you don't want to have a space between the two columns then
    SQL> set head off
    SQL> set colsep ""
    SQL> select col_a, col_b from test;
    abc  FA
    def  KL
    12345123
    SQL> rem if you want to have one space between the two columns then
    SQL> set colsep " "
    SQL> select col_a, col_b from test;
    abc   FA
    def   KL
    12345 123
    SQL>

  • Movie refuses to load variables from text file

    Hi,
    I'm sure you can solve my newbie problem in less than 1
    minute...
    I'm pulling my hair out on a template I bought 2 days ago
    from templatemonster.com
    I am using Flash 8 Pro.
    All I want to do is change an existing textfield that is
    Static to Dynamic and load variables from a text file.
    The Action Script I use to do so comes directly from
    Macromedia documentation (see attached)
    It works fine when I create a brand new movie, but doesn't do
    anything when inserted into the template.
    It doesn't even complain about not finding the text file if I
    rename or delete it!
    Here are the FLA and text file:
    Edit : Link to source file removed
    The textfield I would like to change is in the txt2 symbol.
    Here is how I proceed:
    When I open HEADER.FLA, Flash tells me I'm missing a font,
    ok, so I click on Use Default, I'll deal with this later.
    I open up the Movie Explorer, go to Layer 30, go to Frame 75
    and click once on txt2
    I name the instance "myMovie_mc" and save (converts from
    Flash MX to Flash 8)
    I double-click on the Movie Clip, select the word
    "Automobile" on the Stage, change from Static to Dynamic and call
    that instance "myText_txt"
    Still in the Movie Clip, I create a new layer I call
    "actions", and in Frame 1 I copy the attached Action Script:
    This script works when I create a new flash file, but it does
    absolutely nothing in this template.
    I know I'm doing something wrong, but I wonder what?
    Many thanks to any helping soul!
    Ferris.

    try this:
    // Load text as variable and assign it to the
    // dynamic text field
    var features_lv:LoadVars = new LoadVars();
    features_lv.onLoad = onText();
    features_lv.load("safetyFeatures.txt");
    function onText(success:Boolean) {
    if (success) {
    myText_txt.text = features_lv.safetyfeatures;
    } else {
    myText_txt.text = "unable to load text file.";
    or this
    // Load text as variable and assign it to the
    // dynamic text field
    var features_lv:LoadVars = new LoadVars();
    features_lv.onLoad = function(success) {
    if (success) {
    myText_txt.text = features_lv.safetyfeatures;
    } else {
    myText_txt.text = "unable to load text file.";
    features_lv.load("safetyFeatures.txt");

  • Remotely editing text files in Windows WinRM/PSExec/Powershell/cmd

    Hi!
    How can I remotely edit a text file in Windows?
    I am running and administering a number of Windows 7 workstations and Windows Server 2012 machines. I would like to be able to remotely edit text files on any of these machines. I can connect to any of these machines via psexec or powershell remoting. I
    can also connect via rdp, but for the workstations I would rather not kick the user off unless I absolutely have to.
    For example, we manage state configuration using
    Salt. Local configuration files are stored in C:/salt/conf. I would like to be able to edit these config files on the fly.
    This question on Stack Overflow covers the same topic, but none of the answers are particularly satisfying. Some of the possible solutions
    are:
    Remote Desktop: as I say, I would rather not have to kick a user off their workstation
    Edit a file over a UNC path: this only works for files on a share, and setting up arbitrary shares for quick edits seems like a bad idea.
    Install some manner of ftp or ssh server on all the target computers. This would certainly work, but it is it necessary with WinRM already active? I feel like installing and configuring extra software across all the machines in my organisation would be
    a last resort.
    Edit with a command line editor (e.g. vim, emacs) over a remote powershell session. This doesn't work. I don't understand the technical details, but a powershell remote session isn't interactive in the same way that ssh connections are.
    Edit using powershell's -replace operator, out-file and add-content cmdlets. This works, but is hardly the same as a fully featured text editor.
    Retrieve content from the remote, edit locally, and post back to the remote. This works, and is arguably the best solution I've found. Code sample from SO:
    PS C:\Users\Meredith> Invoke-Command -Session $ps -ScriptBlock {get-content c:/inetpub/myapp/web.config} > web.config
    edit web config
    PS C:\Users\Meredith> get-content web.config | Invoke-Command -Session $ps -ScriptBlock {set-content c:/inetpub/myapp/web.config}
    The last two options are the workflow that I've been using for now. Regex replacement for very simple changes, and copying to local and editing there for more complicated ones. Neither is ideal, but they work. It just feels incredibly old fashioned.
    I'm considering writing a plugin to my editor of choice (vim) to perform the remote fetch and save, to make my workflow a little bit smoother. Before I try that, I just want to know if there's anything that I've missed, or misunderstood.
    Cheers

    What is the "redirector"?
    I posted the same question to Stack Overflow, and was told about administrative shares. I wasn't aware of this, and it's exactly what I wanted. I can open the filetree of a remote machine with the path \\machinename\c$\. Perfectly simple, now that I know
    the answer.

  • How to edit a text file inside jar

    Hi all;
    I have a code that created text file and put this file to other jar archive.
    How can I edit this text file inside jar, add string to this file ?
    Thanks,

    Unpack the jar, edit the file, repack the jar.

  • I can´t edit the text files with SAP BODS 3.2

    Hello
    I can not edit some text files 9-20 megabytes to replace two words in each file, the source is a text file and the same destination but with different name, because with the same name have been unable . My idea is to remove the original and stay with the new performing edition but that if he does , let me file this way:
    SALES_ORDERS_FULL_20140223_150051_006.xml ( ORIGINAL )
    should leave it with me so : SALES_ORDERS_FULL_20140223_150051_006.xml _OLD (AMENDED )
    but strangely leaves me so :
    MICROSOFT_SQL_SERVER_KCC-BI_REPO_KHSA_XI_REPO_KHSA_XI_1543_5434_2_3_Long_INVOICES_INCREMENTAL_20140225_034004_001_xml_dat.txt  (not deseased)
    The type of data you use is long since varchar not allow me because it cuts my data file , use varchar (50000000) but takes the information and short .
    I am using long data type , modify the file and I pass the name of the text files of sap bods for global variables. They are a series of files that are called by a while loop
    Thanks for your answers
    regards

    HIr
    Yes, first I convert long_to_varchar for edit, and convert varchar_to_long.
    I edit before before and later
    Thanks

  • How Do I Edit a Text File in PowerShell??

    How do i edit the text (or paragraphs) in text files using PowerShell?
    Thak You

    Hi,
    That's a pretty broad question, do you have something specific you're trying to accomplish?
    As one example though, this will create an input file (you could just use one you already have, but this is a fully contained example), read it, replace the word 'text' with the word 'fun', and write an output file:
    $exampleFile = @"
    This is some text.
    This is some more text.
    This is even more text.
    $exampleFile | Out-File .\input.txt
    (Get-Content .\input.txt ).Replace('text','fun') | Out-File .\output.txt
    Don't retire TechNet! -
    (Don't give up yet - 12,950+ strong and growing)

  • How to edit/modify a line of a text file using java io

    Hi every body
    I am new 2 java
    I am struck in editing a text file that ends with .dat
    I successfully added,viewed data of the *.dat file.
    but,I cannt edit,delete the lines that i need to do randomly.
    Here is the code i have written.
    import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.DataInputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.LineNumberReader;
    import java.io.RandomAccessFile;
    import java.util.ArrayList;
    import java.util.StringTokenizer;
    public class ReadWriteFile {
         String id=null;
         String name=null;
         String dept=null;
         String doj=null;
         String adrss=null;
         public void WriteFile(String Id,String Name,String Dept,String Doj,String Adrss) throws IOException{
              File f=new File("TraineeDetails.dat");
             if(!f.exists()){
             f.createNewFile();
              BufferedWriter bw=new BufferedWriter(new FileWriter("TraineeDetails.dat",true));
              BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
              System.out.print("Enter Id : ");
              Id=br.readLine();
              System.out.print("Enter name : ");
              Name=br.readLine();
              System.out.print("Enter dept : ");
              Dept=br.readLine();
              System.out.print("Enter doj : ");
              Doj=br.readLine();
              System.out.print("Enter adrss : ");
              Adrss=br.readLine();
              bw.write(Id+"::"+Name+"::"+Dept+"::"+Doj+"::"+Adrss+":END:");
              bw.flush();
              bw.newLine();
              bw.close();
         public static void main(String[] args) throws IOException {
              ReadWriteFile rwf=new ReadWriteFile();
              String TID = null;
              String TADRSS = null;
              String TDOJ = null;
              String TNAME = null;
              String TDEPT = null;
              rwf.ReadFile(TID,TNAME,TDEPT,TDOJ,TADRSS);
         public void ReadFile(String Id1,String Name1,String Dept1,String Doj1,String Adrss1) throws IOException{
              BufferedReader br = new BufferedReader(new FileReader("TraineeDetails.dat"));
              String s;
               while((s = br.readLine())!= null)
                 // Create string tokenizer
                    StringTokenizer st =new StringTokenizer(s, "::");
                      System.out.println("----------------------------------------------");
                      System.out.println("| Trainee Id: "+st.nextToken()             +"|");
                      System.out.println("| Trainee Name: "+st.nextToken()           +"|");
                      System.out.println("| Trainee Department:"+st.nextToken()      +"|");
                      System.out.println("| Date of Joining: "+st.nextToken()        +"|");
                      System.out.println("| Trainee Address: "+st.nextToken()        +"|\n");
                      System.out.println("----------------------------------------------");
               // Close file reader
               br.close();
    }     and here is the data i have written
    Trainee.dat*
    111::jain::roads::2-2008::Blore:END:
    123::tim::service::1-2000::delhi:END:
    444::faru::civil::3-2200::sanapur:END:
    555::niv::cse::10-2000::gnagar:END:
    999::linda::mech::6-2001::tnagar:END:
    258::yansi::geo::8-2002::rtnagar:END:
    656::hari::garrage::3-1000::uttarahalli:END:
    888::muni::hr::5-2009::ernakulam:END:
    007::bond::spy::2-1972::america:END:
    0123::landy::games::6-2003::hdp:END:
    678::maddy::pumbing::4-1999::dispur:END:

    kalanidhi2u wrote:
    I want to randomly access the file
    But i cannt access itmake it RandomAccessFile... RandomAccessFile
    I edited it
    but i cannt edit the file by using itBoth of these are contradictory.

  • Exporting text files in earlier editions of Oracle

    I'm not familiar with Oracle, but hope someone might be able to help me out. I have filed an access to information request with a public agency for data that I'm told is in an Oracle database.
    I have asked for the information to be released in flat text files but was told by the agency that they have an old edition (I'm not sure which one) and cannot export the information in that format as a result. As part of conditions for releasing any data to me, certain fields in their database will have to be severed to strip out personal information etc.
    The agency says it can only provide the data in pdf, which I don't believe I will be able to use.
    I'm wondering if this sounds like a valid argument - if there are earlier versions of Oracle that cannot export raw data in the format I requested. Or are there add-ons or aspects of each edition of Oracle that should make the severing and export possible?
    Thanks for any help you're able to provide...

    Any version of Oracle going back at least into the 1980s has the ability to output text files while simultaneously stripping out confidential/personal data.
    Not one of them is capable of producing that output as a .PDF file.
    Keep in mind that the people you are talking to may not know enough about Oracle to spell it correctly. If they need help they can contact me.
    Refer them to:
    SPOOL and UTL_FILE.

  • Is there any way to capture a list of the steps in editing a particular photo in a text file?

    I have just edited some photos for a friend who was short on time, and now she would like a list of the steps I took in editing.  Is there any way of listing those steps in a text file I could send her?

    Not so far as I know, into a text file. The History is not included in the metadata you can write out to XMP, so it cannot be extracted from there.  The History is embedded in a Catalog only.
    But it would be possible to Export as Catalog one sample image - or, a group of the images concerned. Your friend could open this very small catalog, and view the full History of what has been done to the selection of images it contains.
    Note: the History panel is only available in the Develop module, and you can only get into Develop when the image is not "offline". So your friend would need to get the right picture file(s) referenced into this small Catalog you supply. That can be done by re-browsing the location of the containing folder - so, it is not necessary for the images to be physically  living at the same path in both computers..
    More simply, by writing the final metadata out to the file, and sending the file along with its metadata, at least the finished adjustments can be looked at directly. You only need the Catalog with the History in order to see the sequence - and any changes of mind or explorations that have happened along the way.
    The sequence in which you set nondestructive adjustments does not technically matter; the Catalog method would mainly be of interest, to see an example of your working approach. The nice part about that, is that your friend could click through the History states and see how the image changes on screen - while also watching the sliders, tone curve etc moving around with each new step.

  • Trouble opening and editing a text file

    As part of a larger program, I am trying to open a text file(actually a .py file) and edit a specific line in the file. However, all that I can get the program to do is read the file, but not edit the line. Here is my code. Any help would be greatly appreciated!!
        private void editPythonScript() throws FileNotFoundException, IOException{
            File temp = new File("Temp");
            FileReader fr = new FileReader(path + "\\" + script);
            BufferedReader br = new BufferedReader(fr);
            FileWriter fw = new FileWriter(path + "\\" + temp);
            BufferedWriter bw = new BufferedWriter(fw);
            PrintWriter pw = new PrintWriter(bw);
            String line;
            line = br.readLine();       
            while(line != null){
                if (line == "oids = [ ]"){
                    System.out.println(line);
                    line = "oids = [ " + oids + " ]";
                    System.out.println(line);
                pw.println(line);
                line = br.readLine();
            br.close();    
            fr.close();
            pw.close();
            bw.close();
            fw.close();
            br = new BufferedReader(new FileReader(path + "\\" + temp));
            pw = new PrintWriter(new BufferedWriter(new FileWriter(path+"\\"+script)));
            line = br.readLine();       
            while(line != null){
                pw.println(line);
                line = br.readLine();
            br.close();
            pw.close();
        }

    Awesome! Thanks. I knew it had to be something simple like that!!!

  • How do I add text and edit my PDF file?

    how do i add text and edit my pdf file

    Hi pilothorse,
    To edit a PDF file you need to use Acrobat. If you don't have Acrobat, you can try it for free for 30 days. See www.adobe.com/products/acrobat.html for more information.

  • Editing text file on application server

    Hello,
    I have created a utility in which I can move files from one folder to another. Now we also need a option by which I can edit text file on the server folders. Is there a function module by which I can edit text from application server ?
    Regards,
    Rajesh.

    With OPEN DATASET and READ you can load them into an internal table. Next put them on screen in lets say the text editor (enjoy SAP Controls). This is one way of doing this, other way would be:
    Upload data with OPEN DATASET into internal table, download file to local drive (cl_gui_frontendservices=>gui_download), open it with notepad (for example) edit it and save. Next upload file into your program (cl_gui_frontendservices=>gui_upload) and download it to server again (OPEN DATASET and TRANSFER).
    If available you can also use transaction CG3Z and CG3Y.

  • "This text file is too large to edit" for a very small file

    Hi all,
    I uploaded a small JS script file, less than 2K,  into the Shared Components/Static Files. When I was trying to edit it, I got the error "this text file is too large to edit".
    Anybody experiences this ? Any solutions ?
    My Apex version is 4.2.2.00.11.
    Thanks,
    Vu

    Interesting. I have an SQL file that is about 4K. I copy this file to two files, one with extension .CSS and one JS then upload these three files into the Shared Components/Static Files. I can then edit the SQL and CSS, but I cannot edit the JS file.
    I guess this has something to do with the extension ?
    Thanks,
    Vu

  • Read and Edit Text Files

    I wanted to find out if there is a way to read linux
    configuration files, edit parameters in them and save them using
    coldfusion. I know PHP has the capability to do this, but I don't
    know if CF does and how powerful it is.

    If it's plain text, just write it into a textarea and let
    your users edit it there. When they submit, use cffile to overwrite
    the text file.
    There are other ways to allow users to edit text in a web
    app, such as the "contenteditable" attribute in IE, but the basic
    idea remains the same.
    Or do you mean that the app will alter the files
    automatically? If that's the case, then regular expressions would
    likely be the way to go.

Maybe you are looking for

  • How can i export an 44100Hz audio file to a 43200Hz one?

    Just exactly as the title says.

  • Calculation of With Holding Tax amount

    Hi, We are using the WHT which has the Minimum amount limit as 700 at the Paying document, The issue is there is a  Paying document which clears 4 MM Invoices (Documents are coming from MIRO) 2 MM Invoice with less than 700 amount and other 2 MM Invo

  • Rotate document in Adobe Acrobat Pro

    Hi All How do I custom rotate a document in Adobe Acrobat Pro? I see that there is the option to rotate by 90 or 180 degrees but how do I rotate by just 1 or 10 degrees? Thank you for your help!

  • Encoding

    I have a small problem with encoding! if I use <%include file="file.html"%> it's include that page, but if I have there czech chars, it's show as unreading chars! And it's quite bad! I try to use <meta http-equiv="Content-Type" content="text/html; ch

  • DTW How to Import Journal Entries

    I am attempting to test import some journal entries, but I cannot get DTW to work. I need help with the .csv format (date format, account code format, any crucial fields i need) I also need to know what could be causing DTW to constantly crash, and f