How to write to file

I'm reading in from two separate files, one file contains a number on the each line like and the other contains texts, I want to add the number in front of the text, is there a way to just simply add teh number to the front of each line in the 2nd file?
the only way i know is to store both the number and the text and then outputs to a new file...^^;
thanks!!

if you're on unix the short answer is "man paste".
If you're in java then it's pretty straight foward...open fileA for input or die
open fileB for input or die
open fileO for output or die
do
    read lineA from fileA or break;
    read lineB from inputFileB or break;
    write lineA + lineB to fileO
while trueThere is (as far as I know) no free java library of "file utilities" like this... I think a java unix utilities java project might take off... especially if beanshell takes off, as I suspect it will... beanscript embedded in firefox and weblogic... no more javascript and a h�ll of a lot less DOM... cool!

Similar Messages

  • How to write WSDD file to deploy web service

    I write a server code,I want to deploy it as service,but I don't know how to write WSDD file?I use AXIS and SOAP
    I need help,thanks a lot.
    Regards
    William
    2.24

    Yes, put your wsdd with your class files. But if you want AdminClient to work correctly, be sure all environement variables are set correctly.
    Me, I never use it, I prefer to modify directly the server-config.wsdd

  • How to write a file using mod pl/sql

    hi,
    i am having a submit button in my procedure. which should inturn create .sql file in a file path.
    is there any way to create a fileusing htp and htf methods.
    Thanks in advance
    Hari

    >
    i am having a submit button in my procedure. which should in turn create .sql file in a file path.
    is there any way to create a file using htp and htf methods.
    >
    Why are you wasting your time coding from scratch using the PL/SQL Web Toolkit instead of the APEX framework?
    From Re: how to write a file using mod pl/sql it appears that you are not using APEX, so a number of the approaches APEX offers are not relevant. You appear to be looking for a file download solution using the <tt>wpg_docload.download_file</tt> method, such as:
    create or replace procedure download_file (
        p_filename  in     varchar2
      , p_mimetype  in     varchar2
      , p_content   in out nocopy blob)
    is
    begin
      -- Set up HTTP header.
      -- Use "application/octet" as default MIME type.
      owa_util.mime_header(nvl(p_mimetype, 'application/octet'), false);
      -- Set the size so the browser knows how much to download.
      htp.p('Content-length: ' || dbms_lob.getlength(p_content));
      -- Filename will be used as default by the browser in "Save as..."
      htp.p('Content-Disposition: attachment; filename="' || p_filename || '"');
      -- Close header.
      owa_util.http_header_close();
      -- Stream the file content to the browser.
      wpg_docload.download_file(p_content);
    end download_file;

  • How to write text file in Shockwave?

    Does anybody know how to write text file in Shockwave to
    user's disk?
    Thanks in advance.

    Those Xtras can wreak to much havoc when used with the wrong
    intent.
    What you can do is write with setpref and store a list of
    saves and the
    saves itself seperatly. Then you'd have to build your own
    save/open
    dialog to let the user:
    * pick a previously saved file to load or overwrite
    * have the user type the name of a new file to save.
    Only thing that remains is that the user cannot decide where
    the files
    are saved.
    Manno
    SiuLinda wrote:
    > Thanks a lot for your reply.
    > Yes, cookies is good but I have to write a program to
    save the text file in
    > where the user wants, user can open these files later if
    they like, like using
    > Filextra and Fileio, but I found all of these xtras seem
    to be not supported in
    > shockwave.
    >
    Manno Bult
    [email protected]

  • How to write certain file On jCD through Java

    hi all,
    I got big problem in java , would anybody tell me how to write certain file onto CD through java. Is there any API available for this.
    Thanks in advance
    --Harish                                                                                                                                                                                                                                                                                                                                                               

    You might check this thread.
    http://forum.java.sun.com/thread.jspa?threadID=212748&tstart=90

  • How to write to file Unicode characters

    I have PDF files that I need to copy some strings out of and put them in various fields in a Postgres database. The goal is a Java screen into the database, whiere I mark and copy the PDF text and then paste it into a field in a Swing window, and from there into the database.
    I am unsuccessful at reading a PDF file, so I have opted to cut and paste the PDF file into an MS word file. This results in errors in certain unicode characters. I am trying to rectify them by a simple program, a start of which is below, by a replacement of the erroneous char by the proper unicode symbol. As, shown by the following, I cannot figure out how to write out a unicode character. Do I need to wrap (which I don't know much about yet)? Or do I have a file problem? (I have a Vista machine.) I don't think it should be impossible to write unicode into a file, as I am able to write into MS Word files phonological symbols, Russian, and Sanskrit. So, it must be in the java.
    P.S.: I am reading Schildt's Java: A Beginner's Guide and am through chapter10, but remaining chapters are on threads, enumerations, autoboxing, static import, annotations; generics,; applets, events, and miscellaneous topics, and, finally Swing. Maybe its in the autoboxing?
    Any help would be most appreciated.
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.PrintWriter;
    import java.io.IOException;
    public class CopyCharacters {
    public static void main(String[] args) throws IOException {
    FileReader inputStream = null;
    //FileWriter outputStream = null;
    PrintWriter outputStream = null;
         char longa = 0x0101;
         int longc = 0x0101;
         char capA = 0x0041;
         char longb = 0x0111;
    // Unicode for uppercase Greek omega character char uniChar = '\u039A'
         char uniChar = '\u039A';
    // Character ca = new Character('0x0101'); // illegal
         Character cb = new Character('\u0101');
         Character cc = '\u0101';
    int c;
    try {
    inputStream = new FileReader("Cardona1.txt");
    outputStream = new
                   PrintWriter(new FileWriter(
                        "characteroutput.txt"));
              outputStream.println( "character1 " + capA); //yields A
              outputStream.println( "character2 " + longa); //yields ?
              outputStream.println( "character3 " + '\u0101'); //yields ?
              outputStream.println( "character4 " + longc); //yields 257
              outputStream.println( "character5 " + "S\u00ED Se\u00F1or"); // yields character Sí Señor
              outputStream.println( "character6 " + "S'\u00ED' Se\u00F1or"); // yields S'í' Señor
              outputStream.println( "character7 " + "S\u0121 Se\u00F1or"); // yields character S? Señor
              outputStream.println( "character8 " + "S'\u0121' Se\u00F1or"); // yields character S'?' Señor
              outputStream.println( "character9 " + uniChar);// yields character ?
              outputStream.println( "character10 " + '\u00FF');// yields character ÿ but fails on \u0100.
    // only 0-255!!
              outputStream.println( "character11 " + cc);// yields ?
              outputStream.println( "character12 " + cb);// yields ?
              outputStream.println( "character13 ?");// yields ?
    while ((c = inputStream.read()) != -1) {
         // outputStream.writeln(c);- error
    } finally {
    if (inputStream != null) {
    inputStream.close();
    if (outputStream != null) {
    outputStream.close();
    }

    I am unsuccessful at reading a PDF file, so I have opted to cut and paste the PDF file into an MS word file. This results in errors in certain unicode characters.Stop right there. You are digging a hole. Stop digging. Fix the problems with reading the PDF file.

  • Hi how to write text file continuosly

    hi i know how to write a text file but if i write something and close the
    whole program, then when i open the program and do the samething,
    i wanna write something contiguosly, write the next line of the very last saved line..
    but..i tried couple of times,but the written sentence just overlapped,,,and
    can't write continuously,,,
    how to solve it............

    Are you saying you want to create a file the first time you run a program, and append to the file the second time? If so, check the constructors for the class you are using to write the file. There should be one that takes a boolean flag telling it you want to append instead of overwrite. Set the flag to true.
    For example:
    http://java.sun.com/j2se/1.5.0/docs/api/java/io/FileWriter.html#FileWriter(java.lang.String, boolean)FileWriter(String fileName, boolean append)
    Constructs a FileWriter object given a file name with a boolean indicating whether or not to append the data written.

  • How to write a file in unix server through oracle plsql code

    Hi All,
    My requirement is to create and write a file (any file for eg txt file) in unix box with in a specified directory through oracle plsql code.
    Oracle sits in windows server.
    using utl_file package we can create directory where oracle resides and write it there in oracle server in our case windows..
    But here we need to create,write a file but in unix server which is different server than where the oracle server resides..
    we are using Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    Can any one one please help me out in this issue...
    Thanks in Advance.
    Prakash

    Mr Prakash,
    Why are you asking this question multiple times in every forum you can spell?
    Valid responses have been presented to you already two times.
    Can you explain why you can't follow them up, but continue to abuse this forum by repeating doc questions?
    Sybrand Bakker
    Senior Oracle DBA

  • How to write a file into UNIX!

    Hi Group!
    I am trying to write an error file into UNIX directory using 'OPEN DATASET ERRFILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT'. But unfortunately i am getting a dump as it is giving the subrc 8 and dumping with CX_SY_FILE_OPEN_MODE.
    The path looks like /sap/DE1/batch/data/SCM_YM/partfiles/HGMEH011.20071001150344
    Is there any special command or way to write the file into UNIX?
    Quick response would be of great help.
    Suresh

    The detailed error is
    The file '&FILENAME&' was not opened, or was opened in the wrong mode.
    Can you please try to create a new file that does not exist.
    then we can check whether you have authorization or not.
    OPEN DATASET to a file already opened - in the same internal mode - triggers the exception.
    THtas why you just create a file with some rough name ( may be ur name) intially and then check.
    bye sasi

  • How to write excel file (.xlsx) using file adapter without using java code

    Hi All,
    In soa suite 11g Is there any ways to write the data to the excel ( xlsx ) file using fileadapter and not using java code..Thanks in Advance

    Hi Siva,
    I don't think there is any way to write .xls file directly. You'll have to use some Java API (iText etc.) to create an .xls file. However, you can write .csv file that can be easily converted into .xls at the target end. In MS, it opens as Excel file if delimiter is comma *,*.
    Regards,
    Neeraj Sehgal

  • How to write text file in acrobat javascript

    Hi,
    I need to write a txt file from acrobat javascript. How can i do this?
    My requirement is to get identity mail id and name? Using acrobat javascript i can able to take mail id as identity.email. I get the mail id as alert and in console
    How can i write this mail id to text file?
    Thanks in advance...

    Hi,
    here is a commented program stanza
    var v = this.getField("myTextField").value;
    // Get the contents of the file attachment with the name "MyNotes.txt"
    var oFile = this.getDataObjectContents("MyNotes.txt");
    // Convert the returned stream to a string
    var cFile = util.stringFromStream(oFile, "utf-8");
    // Append new data at the end of the string
    cFile += "\r\n" + v;
    // Convert back to a stream
    oFile = util.streamFromString( cFile, "utf-8");
    // Overwrite the old attachment
    this.setDataObjectContents("MyNotes.txt", oFile);
    // Read the contents of the file attachment to a multiline text field
    var oFile = this.getDataObjectContents("MyNotes.txt");
    var cFile = util.stringFromStream(oFile, "utf-8");
    this.getField("myTextField").value = cFile;
    [signature deleted by host]

  • How to write to file using fixed width columns

    I need to write some data to a text file such that it is formatted in columns of fixed width. Each column can have different width. eg if i have to write 5 fields in each record the first field would be of 5 characters, second field of 3 characters and so on.
    Can u please suggest how I can do it. Its urgent.

    Can't you search? Now you know what to google on: java 5 printf
    Kaj

  • How to write to file at user defined interval

    Hello
    I am trying to find a way to take data samples from a stream of strain measurements that is input to Labview from a NI 9237. These samples must be written to a file for later analysis. The vi must be capable of recording a burst of data at a user defined interval and sampling rate.
    For example record at 10Hz for 10 seconds every 15 minutes.
    My attempt at doing this is attached (as you can probably tell see I am quite a beginner at Labview).
    In my example I have used a random generator to simulate my data from the NI 9237. By using a for loop I have tried to get the vi to write 5 data points to the file. However it writes the same data point to the file 5 times, instead of 5 successive data points.
    Ultimately I would like the vi to write data to the file for a period of time (10 seconds) instead of writing a defined number of data points.
    Can anyone please advise how I should go about achieving this?
    Many thanks
    Solved!
    Go to Solution.

    I would create a separate task which is used to write the data. Data to be written to the file can be passed to this task via a queue. You could set values to determine how much data needs to be written and at what intervals. Your data acquisition can post data to the queue. Your queue can be configured so that it will only contain enough entries to hold the amount of burst data you want to save. Any additional data posted to the queue would be dropped. Your write task could be in a loop that periodically checks to see if your time interval has been met. When it does it can dequeue all the elements from the queue and write them to the file. It will go back to waiting for the timer to expire. Now that the queue is empty your data acquisition will be able to fill it again with the next set of data.
    NOTE: When you have your logger task pull the data from the queue you should use the queue status vi to grab all of the data at once and then flush it. If you dequeue elements one at a time in a loop your data acquisition task will start filling it again before you have written everything out. This would result in more data getting written to file than you want.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • How to Write a file from hex format to another format

    hi I am trying to create a file (IBM AFP-printer format) from the hex file which i have created after reading that IBM afp file. Now i have to do some changes in that hex file data and store it back to the same format.
    I have tryed storing it using:
    Writer out = new OutputStreamWriter(outputStream,"Cp1252");
    but it is taking hex format only.
    I have checked encoding of afp file by this code
    File inputFile = new File( "C:\\ACode\\new2.afp" ) ;
              FileInputStream inputStream = new FileInputStream(inputFile );
         InputStreamReader in = new InputStreamReader(inputStream);
    System.out.println(in.getEncoding());
    it is showing Cp1252 only.
    But i am unable to store it back to same format
    Thanks

    I don't really know what the IBM APF stream format is, but I suspect that your approach is not right. If you really want to read and write raw hex bytes, then do not use readers and writers; instead use pure streams. The reason is that readers and writers are designed to deal with character-oriented data, and will automatically perform translations on input and output.
    On the other hand, if you could find the correct encoding/decoding software for the IBM format in question, well then readers/writers would be fine, and you could do all of your "internal" work in unicode.

  • How to write UDL file in Labview for Database connection

    Hi
    I am using SQL Server database. I am making connection with SQL by using UDL file. If I create  Normal UDL file in windows and make connection it happens.  I want to change or add some parameter Like database name. If I am changing this value by using labview, the file gets corrupted, and not able to make connection with SQL.
    I want to create database by program. User should not create the database. 
    Kindly suggest me the proper solution. 
    Regards
    Prabhakant Patil
    [email protected] 
    Regards
    Prabhakant Patil

    It may look like a text file, but it's not a text file that uses plain-old ASCII. If you open it in Notepad you won't see anything obvious. You actually have to open the UDL file with a hex editor, and you will see the differences. Specifically:
    The file starts with the header FF FE. This indicates Unicode. LabVIEW does not support Unicode.
    Each characters is actually 2 bytes. Thus, the first character you see in Notepad is "[" (for the section start). In hex this is 05 for plain-old ASCII, but 05 00 for Unicode (which is what's actually in the file).
    Thus, if you absolutely must write out the file using LabVIEW you will need to write it out in binary mode, inserting the 0x00 bytes, and the FF FE at the start. 
    Message Edited by smercurio_fc on 03-24-2010 09:39 AM

Maybe you are looking for

  • Problem with move of iTunes music to external hard drive

    My hard drive was getting full and I bought a new external drive and moved iTunes to it carefully following directions on ilounge and Apple support. 1. I first hit consolidate library and only moved the iTunes music file (as per the iLounge direction

  • Windows does not recognize my nano

    Hi there, I'll try to explain my problem: I just got my nano and connected it before installing itunes (I think that was wrong) so it showed the ipod drive at "my computer", then i tried to install itunes but when it asks to connect the ipod to see i

  • LDAP web search not working on AD LDS instance

    Hello all ! Let me explain the goal before the problem : We need to setup a directory service in our DMZ so our web portal can provide an address book without having to connect to the AD. We setup (this is all in the lab environment for now) an AD LD

  • When I updated my software, i got my sisters pictures and information on my ipod. How do i get my information back?

    My sister updated my software under her name anmd now my ipod has all her pictures, music, information, and all my apps are gone.  I want all my information back and i can't find out how.  My ipod is listed under her name now too. I called apple but

  • CALLING REPORT

    Hi , Iam calling a report from form using run_product.I want to supress the display of parameter form of the report.How i do it? I generated the report with no parameter form option.It is not displaying the parameter form when i run it in the report