Time Stamp, read from filename and change automatically

Hi,
while converting to an format (video monkey) which can be read by iMovie the files lost the propper time stamp. However, date and time is still part of the filename. Is there an option to change date and time within iMovie or any other app based on the file name so that I do not need to make this manualls for each individual file?
Rgds
barino

I would suggest using the ISO-8601 UTC format.
The only limitation is that the string value is in reference to GMT.
The conversion of the string back to a timestamp will present the date/time on your front panel indicator as local time.
https://lavag.org/topic/15034-timestamp-support-for-format-into-string-scan-variant-from-string-stri...
Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.
"You are what you don't automate"
Inplaceness is synonymous with insidiousness

Similar Messages

  • How to reverse from quality and change the vendor account.

    I had made GR, but posted wrong entries, instead of doing one vendor account & i had made in other vendors account, this lot is passed by quality also that means it UD is also done.
    how to reverse from quality and change the vendor account.
    Thanks and Regards

    hi Raj,
    Reversing Stock Postings Locate the document in its SAP Library structure
       1. Choose Logistics ® Materials Management ® Inventory Management ® Goods Movement ® Goods receipt ® For purchase order ® PO number known.
    The initial screen for creating a goods receipt for a purchase order appears.
       2. In the field for the movement type, enter
       3. 102 (goods receipt for a purchase order into warehouse - reversal). In the field for the purchase order, enter the purchase order number for the original goods receipt.
    Note
    You can copy the purchase order number from the inspection lot.
       4. Choose Enter to display the selection screen for the purchase order items.
       5. Select the purchase order item for which you want to create the goods receipt and set the Stock type indicator to the stock to which the goods were originally posted with the usage decision (for example, F for unrestricted-use stock or S for blocked stock).
       6. Save the goods receipt and exit the Materials Management component.
       7. Choose Logistics ® Quality management ® Quality inspection ® Inspection lot ® Usage decision ® Change with history.
    The initial screen for changing a usage decision appears.
       8. Enter the number of the inspection lot for which you previously made the usage decision and choose Usage decision (UD).
       9. To cancel the inspection lot, choose Usage decision ® Functions ® Cancel lot in the usage decision screen.

  • Everytime I sync my iPhone 4 it pops up a notice saying that my iphone cannot be written to or read from. wont apply changes at the end of the sync cycle.

    everytime I sync my iPhone 4 it pops up a notice saying that my iphone cannot be written to or read from. wont apply changes at the end of the sync cycle. it synced once and now nothing! help?

    Did a health check on my Drive D:  Issues were found and repaired. Disabled Kaspersky and tried a sync with iTunes (Success). Re-enable Kaspersky and iTunes is still working.  Interesting in that I thought my iTunes only involved Drive C:  What led me to problems with Drive D: were indications that there was a problem with Adobe cache for Adobe Bridge.  I also purged that cache. In looking at my nightly backup there was also an indication there had been some intermittent issues of not being able to read the disk.
    Bottom line...  all is working again and need to continue to monitor the health of my second hard drive.

  • No more data to read from socket" and OALL8 is in an inconsistent state

    HI All
    user getting various errors – such as “No more data to read from socket” and “OALL8 is in an inconsistent state”.
    database is on windows 2k8-64 bit
    database is 11.2.0.1.0
    is this problem with JDBC drivers on client side
    thanx

    You will usually get this error when the connection get drop before completing the query/transaction.
    Check the alert log file for core dump as well as the trace file associated to the core dump.
    Also check if you are using the right driver version (ojdbc?)
    Regards
    Michel.
    www.odbTools.com

  • Is there any way to know data is read from tape and written to disk

    is there any way to know data is read from tape and written to disk

    784786 wrote:
    Just asked because I am doing restoration, I see files read from tape and then restored, but can't find them physically there.
    Is there any way I can find it.What kind of restoration? What kind of files?
    The usual "no information" question is of the form "My car won't start. Tell me how to fix it"
    Yours is a bit different - "I tried to fix my car. Tell me how to know it's fixed".

  • Read character 3+4 from filename and move to other position

    Hello,
    I need a javascript to read my filename (I have the one for the full filename) and especially the 3rd and 4th position of the filename.
    The characters on position 3 and 4 must be moved to the position just before the extension.
    Example:
    4PEN12345.pdf (old name) should be 4P12345_EN.pdf
    Now I have the following script to extract all pages in an existing pdf file to separate pages with all the same suffix before the extension
    /* Extract Pages to Folder */
        var re = /.*\/|\.pdf$/ig;
        var filename = this.path.replace(re,"");
            for ( var i = 0;  i < this.numPages; i++ )
            this.extractPages
                nStart: i,
                nEnd: i,
                cPath : filename + "_page_" + (i+1) + "_EN.pdf"
    Can anybody help me to set me on the right direction?

    Now I have the file 4PBG12345-1.pdf (7 pages included in the pdf).
    Your script as I filled in:
    /* Extract Pages to Folder */
        var re = /.*\/|\.pdf$/ig;
        var filePath = this.path.replace(this.documentFileName, "");
        var oldFileName = this.documentFileName;
        var suffix = oldFileName.substring(2,4);
        var newFileName = oldFileName.substring(0,2) + oldFileName.substring(4).replace(".pdf", "_"+suffix+".pdf");
        var newFilePath = filePath + newFileName;
            for ( var i = 0;  i < this.numPages; i++ )
            this.extractPages
                nStart: i,
                nEnd: i,
                cPath : newFilePath
    Result:
    1 file ==> 4P12345-1_BG.pdf (7 pages included in the pdf)
    Of course, because the syntax for extracting and adding automatic pages is not filled in. So, that was my question, how must I nest to add the right:
    Filepath+oldfilenamesubstring(0,2)+oldfilenamesubstring(4)+_page_i++_+suffix+.pdf in the extract section
    So, my example must result in 7 pdf's:
    4P12345-1_page_1_BG.pdf (with content of page 1)
    4P12345-1_page_2_BG.pdf (with content of page 2)
    4P12345-1_page_3_BG.pdf (with content of page 3)
    4P12345-1_page_4_BG.pdf (with content of page 4)
    4P12345-1_page_5_BG.pdf (with content of page 5)
    4P12345-1_page_6_BG.pdf (with content of page 6)
    4P12345-1_page_7_BG.pdf (with content of page 7)

  • Time Stamp format from file problem

    Hey there,
    I have a pretty peculiar problem. I'm working on two PCs right now, one is my private laptop running on Windows 8, and the other one the PC at my workplace, running on Windows XP, but on the same version of LabVIEW. I use this method to save the time and date to a tab delimited .txt file. Then later, with another VI, I read the date and time written to file to reconstruct the time stamp. I've noticed that dates written to file from my workplace differ from the dates written from my private PC: in Windows XP, there are "-" separating the day, month and year. In Windows 8, it's "/". There are other differences (see pictures). So naturally, when reading from file using my VI, I can only read on my private PC files (or at least dates) written on my private PC and vice versa, I can't read files written on my private PC on my workplace PC. Can anybody tell me why there's a difference in format, or how to write the date uniformly so I can read it on any PC, or how to read both formats?
    So this is the method I use for writing the time and date (the subVI only inserts a certain number of TAB characters).
    This is what it looks like on Windows 8
    This is what it looks like on Windows XP
    This is the VI (attached) I use to read the time stamps (the first row actually contains the time stamp in HH:MM: SS format for a whole bunch of measurements).
    Have a nice day.
    Solved!
    Go to Solution.
    Attachments:
    Extract Time Stamps.vi ‏22 KB

    I would suggest using the ISO-8601 UTC format.
    The only limitation is that the string value is in reference to GMT.
    The conversion of the string back to a timestamp will present the date/time on your front panel indicator as local time.
    https://lavag.org/topic/15034-timestamp-support-for-format-into-string-scan-variant-from-string-stri...
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness

  • Time stamp wrong in skype and thunderbird while menu bar has correct time

    I noticed in my applications like Skype, MSN Messenger, Thunderbird email that the time stamp was wrong. But the Menu Bar clock and the system preferences Date and Time were correct. My exact error is that the app timestamp always showed the time as PM.
    I googled for answers and several topics mentioned a locked / misplaced / corrupted localtime file.
    However, The real reason is that I had a custom time format under Languages and Text system preference. For some reason the custom format showed morning as PM and evening as PM. I opened the preference, selected time, and changed it from Custom to USA.
    There are several similar errors (always showing 20 before time, ie 20:43, always is 7 oclock, ie 7:32, or etc) that were mentioned in other tickets I read.
    I followed this post to go into languages and Text to correct the custom time format; http://discussions.apple.com/message.jspa?messageID=11503087 (see last post. IGNORE the part about plist!)

    Mail displays the date & time according to your System Preferences > International > Formats settings. The specific format used (i.e. Short, Long, etc.) may depend on the column width. It looks like there is something wrong with your Dates > Customize or Times > Customize settings there...
    > I've tried expanding the date column width in Mail, and changing to US
    (instead of International) Date / Time format in my system preferences
    Not sure what you mean. I don’t see an “International” option anywhere other than the name of the International preferences panel itself...

  • How to read from BLOB and Write to a file in user readable format.

    Hi,
         I am trying to read from a BLOB column and write the content to a file in user readable format. So far I was able to read the Blob column using dbms_lob, but not able to write to a file. Kindly let me know the method to do this.

    Hi, with this Java Code from Oracle Technet it's a easy thing:
    // classpath= /ORACLE/u01/app/oracle/product/10.2.0.3/jdbc/lib/ojdbc14.jar
    // Java SQL classes
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.Statement;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    // Oracle JDBC driver class
    import oracle.jdbc.OracleDriver;
    // Java IO classes
    import java.io.IOException;
    import java.io.BufferedReader;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    //Java Util classes
    import java.util.Properties;
    * This class demonstrates the Oracle JDBC 10g enhanced features for inserting
    * and retrieving CLOB data from the database. Using the new features, large
    * data of more than 32765 bytes can be inserted into the database using the
    * existing PreparedStatement.setString() and PreparedStatement.getString()
    * methods.
    public class ClobMan {
    /* Database Connection object */
    private Connection conn = null;
    /* Variables to hold database details */
    private String url = null;
    private String user = null;
    private String password = null;
    // Create a property object to hold the username, password and
    // the new property SetBigStringTryClob.
    private Properties props = new Properties();
    /* String to hold file name */
    private String fileName = null;
    * Default Constructor to instantiate and get a handle to class methods
    * and variables.
    public ClobMan(String fileName) {
    this.fileName = fileName;
    * Main runnable class.
    public static void main(String[] args) throws SQLException {
    // Instantiate the main class.
    ClobMan clobMan = new ClobMan(args[0]);
    // Load the Oracle JDBC driver class.
    DriverManager.registerDriver(new OracleDriver());
    // Load the database details into the variables.
    String dbUrl = "jdbc:oracle:thin:@pmol:1550:dbpmol";
    clobMan.url = dbUrl;
    clobMan.user = "gh10";
    clobMan.password = "secret";
    // Populate the property object to hold the username, password and
    // the new property 'SetBigStringTryClob' which is set to true. Setting
    // this property allows inserting of large data using the existing
    // setString() method, to a CLOB column in the database.
    clobMan.props.put("user", clobMan.user );
    clobMan.props.put("password", clobMan.password);
    clobMan.props.put("SetBigStringTryClob", "true");
    // Check if the table 'CLOB_TAB' is present in the database.
    //clobMan.checkTables();
    // Call the methods to insert and select CLOB from the database.
    //clobMan.insertClob();
    clobMan.selectClob();
    * This method will insert the data into a CLOB column in the database.
    * Oracle JDBC 10g has enhanced the existing PreparedStatement.setString()
    * method for setting the data more than 32765 bytes. So, using setString(),
    * it is now easy to insert CLOB data into the database directly.
    private void insertClob() throws SQLException {
    // Create a PreparedStatement object.
    PreparedStatement pstmt = null;
    try {
    // Create the database connection, if it is closed.
    if ((conn==null)||conn.isClosed()){
    // Connect to the database.
    conn = DriverManager.getConnection( this.url, this.props );
    // Create SQL query to insert data into the CLOB column in the database.
    String sql = "INSERT INTO clob_tab VALUES(?)";
    // Read a big file(larger than 32765 bytes)
    String str = this.readFile();
    // Create the OraclePreparedStatement object
    pstmt = conn.prepareStatement(sql);
    // Use the same setString() method which is enhanced to insert
    // the CLOB data. The string data is automatically transformed into a
    // clob and inserted into the database column. Make sure that the
    // Connection property - 'SetBigStringTryClob' is set to true for
    // the insert to happen.
    pstmt.setString(1,str);
    // Execute the PreparedStatement
    pstmt.executeUpdate();
    } catch (SQLException sqlex) {
    // Catch Exceptions and display messages accordingly.
    System.out.println("SQLException while connecting and inserting into " +
    "the database table: " + sqlex.toString());
    } catch (Exception ex) {
    System.out.println("Exception while connecting and inserting into the" +
    " database table: " + ex.toString());
    } finally {
    // Close the Statement and the connection objects.
    if (pstmt!=null) pstmt.close();
    if (conn!=null) conn.close();
    * This method reads the CLOB data from the database by using getString()
    * method.
    private void selectClob() throws SQLException {
    // Create a PreparedStatement object
    PreparedStatement pstmt = null;
    // Create a ResultSet to hold the records retrieved.
    ResultSet rset = null;
    try {
    // Create the database connection, if it is closed.
    if ((conn==null)||conn.isClosed()){
    // Connect to the database.
    conn = DriverManager.getConnection( this.url, this.props );
    // Create SQL query statement to retrieve records having CLOB data from
    // the database.
    String sqlCall = "SELECT rownum, name, sourcetext FROM t_source";
    pstmt= conn.prepareStatement(sqlCall);
    // Execute the PrepareStatement
    rset = pstmt.executeQuery();
    String rownum = null;
    String o_name =null;
    String clobVal = null;
    // Get the CLOB value from the resultset
    //java.io.BufferedWriter out = new java.io.BufferedWriter(new java.io.FileWriter("pr_all.sql"));
    while (rset.next()) {
    rownum = rset.getString(1);
         o_name = rset.getString(2);
         clobVal = rset.getString(3);
    System.out.println(" length: "+clobVal.length()+" "+o_name+" "+rownum);
         java.io.BufferedWriter out =
         new java.io.BufferedWriter(new java.io.FileWriter(o_name+".prc"));
         out.write(clobVal);
         out.newLine();
         out.write("/");
         out.newLine();
         out.newLine();
    out.flush();
    out.close();
    } catch (SQLException sqlex) {
    // Catch Exceptions and display messages accordingly.
    System.out.println("SQLException while connecting and querying the " +
    "database table: " + sqlex.toString());
    } catch (Exception ex) {
    System.out.println("Exception while connecting and querying the " +
    "database table: " + ex.toString());
    } finally {
    // Close the resultset, statement and the connection objects.
    if (rset !=null) rset.close();
    if (pstmt!=null) pstmt.close();
    if (conn!=null) conn.close();
    * Method to check if the table ('CLOB_TAB') exists in the database; if not
    * then it is created.
    * Table Name: CLOB_TAB
    * Column Name Type
    * col_col CLOB
    private void checkTables() {
    Statement stmt = null;
    ResultSet rset = null;
    try {
    // Create the database connection, if it is closed.
    if ((conn==null)||conn.isClosed()){
    // Connect to the database.
    conn = DriverManager.getConnection( this.url, this.props );
    // Create Statement object
    stmt = conn.createStatement();
    // Check if the table is present
    rset = stmt.executeQuery(" SELECT table_name FROM user_tables "+
    " WHERE table_name = 'CLOB_TAB' ");
    // If the table is not present, then create the table.
    if (!rset.next()) {
    // Table does not exist, create it
    stmt.executeUpdate(" CREATE TABLE clob_tab(clob_col CLOB)");
    } catch (SQLException sqlEx) {
    System.out.println("Could not create table clob_tab : "
    +sqlEx.toString());
    } finally {
    try {
    if( rset != null ) rset.close();
    if( stmt != null ) stmt.close();
    if (conn!=null) conn.close();
    } catch(SQLException ex) {
    System.out.println("Could not close objects in checkTables method : "
    +ex.toString());
    * This method reads the specified text file and, returns the content
    * as a string.
    private String readFile()
    throws FileNotFoundException, IOException{
    // Read the file whose content has to be passed as String
    BufferedReader br = new BufferedReader(new FileReader(fileName));
    String nextLine = "";
    StringBuffer sb = new StringBuffer();
    while ((nextLine = br.readLine()) != null) {
    sb.append(nextLine);
    // Convert the content into to a string
    String clobData = sb.toString();
    // Return the data.
    return clobData;
    }

  • Read from file and plot data against timestamp

    Hello,
    I know that there are already many posts regarding the question I m about to ask. But, I somehow dont seem to achieve what I want using the suggestions given in the other posts.
    My problem is that, I have a file with the first column as a time stamp containing hour, minute, second and millisecond. The second column in a set of pressure values. I want to plot a graph of these pressure values against the timestamp recorded in this .txt file. Whatever I do, the timestamp values seem to skip by a couple of seconds.
    How do i do this correctly?
    Also, Is it advisable to use the read from file or the read from spreadsheet file vi? Kindly help me out.
    Thanks and regards.

    Hey, I was having a similar issue the other day.  The first problem I had was how to open the file and actually get the timestamp information.  Since I'm using LabView 8.0, I had to go into Read Spreadsheet File and create a new vi to open strings (in an array form).  That's the Read Spreadsheet File (string) vi below.  Then, I had to figure out how to convert the string of a timestamp to something meaningful to me.  The Timestamp2.vi is how I did that below.  I'm also including a little test file.  So, to run Timestamp2.vi, you will have to input the right base path, and have the Read Spreadsheet File (string).vi in the same place as Timestamp2.  Hope that helps.  I think I'm finally getting this stuff, so let me know if it doesn't work.
    Attachments:
    Test.txt ‏1 KB
    Timestamp2.vi ‏28 KB
    Read From Spreadsheet File (String).vi ‏25 KB

  • Appending a creation date/time stamp to a filename using MS Command Language

    I need to access the creation date and time of an existing file and then append that date/time to the filename using MS command language in a .bat file.  The code executes on a Windows server.   I'm looking at different options for doing
    this.  I know it can be done using MS Powershell scripting.  Any other suggestions appreciated.  Thanks

    I tested the answer you supplied here:
    http://social.technet.microsoft.com/Forums/en-US/38873a13-f3f2-40f2-bb96-c1c63722caab/adding-a-datetime-stamp-to-a-file-using-ms-command-language?forum=winserverpowershell
    and it worked.
    Richard Mueller - MVP Directory Services

  • Reading from .CSV and storing it into a collection

    Hi folks,
    Is there a way to make a dynamic procedure to work with .CSV documents and store it into a collection? For example you have to make a procedure to read from .CSV but users upload 10 different version that have different number of columns.
    Normally I would define a record type to match those columns and store it into a collection. However if I don't know the number of columns I would need to define 10 records in advance which I am trying to avoid.
    Problem is I cant define SQL elements on the fly. Meaning on production I don't have the rights to dynamically create a table to match my columns and then drop the table after I no longer need it so I need to store data into a collection.
    And the last option where I would loop through the document and then do the operations I need is not good since the document is a part of other procedures that write and read from it. The idea is to pick the data, store it into a collection, close the file and then work with it.
    This is what I got so far:
    declare
      -- Variables
      l_file      utl_file.file_type;
      l_line      varchar2(10000);
      l_string    varchar2(32000);
      l_delimiter varchar2(10);
      -- Types
      type r_kolona is record(
        column_1 varchar2(500)
       ,column_2 varchar2(500)
       ,column_3 varchar2(500)
       ,column_4 varchar2(500)
       ,column_5 varchar2(500));
      type t_column_table is table of r_kolona;
      t_column    t_column_table := t_column_table();
    begin
      /*Define the delimiter*/
      l_delimiter := ';';
      /*Open file*/
      l_file      := utl_file.fopen( 'some dir', 'some.csv', 'R');
      /*Takes first row of document as header*/
      utl_file.get_line( l_file, l_line);
      loop
        begin
          utl_file.get_line( l_file, l_line);
          /*Delete newline operator*/
          l_string                         := rtrim( l_line, chr(13)) || l_delimiter;
          /*Extend array and insert parsed values */
          t_column.extend;
          t_column(t_column.last).column_1 := substr( l_string, 1, instr( l_string, l_delimiter, 1, 1) - 1);
          t_column(t_column.last).column_2 := substr( l_string, instr( l_string, l_delimiter, 1, 1) + 1, instr( l_string, l_delimiter, 1, 2) - instr( l_string, l_delimiter, 1, 1) - 1);
          t_column(t_column.last).column_3 := substr( l_string, instr( l_string, l_delimiter, 1, 2) + 1, instr( l_string, l_delimiter, 1, 3) - instr( l_string, l_delimiter, 1, 2) - 1);
          t_column(t_column.last).column_4 := substr( l_string, instr( l_string, l_delimiter, 1, 3) + 1, instr( l_string, l_delimiter, 1, 4) - instr( l_string, l_delimiter, 1, 3) - 1);
          t_column(t_column.last).column_5 := substr( l_string, instr( l_string, l_delimiter, 1, 4) + 1, instr( l_string, l_delimiter, 1, 5) - instr( l_string, l_delimiter, 1, 4) - 1);
        exception
          when no_data_found then
            exit;
        end;
      end loop;
      /*Close file*/
      utl_file.fclose(l_file);
      /*Loop through collection elements*/
      for i in t_column.first .. t_column.last
      loop
        dbms_output.put_line(
             t_column(i).column_1
          || ' '
          || t_column(i).column_2
          || ' '
          || t_column(i).column_3
          || ' '
          || t_column(i).column_4
          || ' '
          || t_column(i).column_5);
      end loop;
    exception
      when others then
        utl_file.fclose(l_file);
    end; Stupid version would be to define a record with 50 elements and hope they dont nuke the excel with more columns :)
    Best regards,
    Igor

    Igor S. wrote:
    Use some to query data and then fix wrong entries on prod (insert, update, delete). Manipulate with some and then make new reports. The first that come to mind but basicly is to write a procedure that can be used for ANY .csv so I dont have to rewrite the code.This is logically wrong and smacks of poor design.
    You're wanting to take CSV files with various unknown formats of data, read that data into some generic structure, and then somehow magically be able to process the unknown data to be able to "fix wrong entries". If everything is unknown... how will you know what needs fixing?
    Good design of any system stipulates the structures that are acceptable, and if that means you know there are just 20 possible CSV formats and you can implement a mechanism to determine which format a particular CSV is in (perhaps something in the filename?) then you will create 20 known targets (record structures/tables or whatever) to receive that data into, using 20 external tables, or procedure or whatever is necessary.
    Doing anything other than that is poor design, leaves the code open to breaking, is non-scalable, hard to debug, and just wrong on so many levels. This isn't how software is engineered.
    For example you have 20 developers that have to work with .CSV files. So when someone has to work with a .CSV he would call a procedure with parameters directory and file name. And as a out parameter would get a collection with .CSV stored inside.As others have mentioned, give the developers an Apex application for their data entry/manipulation, working directly on the database with known structures and validation so they can't create "wrong" data in the first place. They can then export that as .CSV data for other purposes if really required.

  • Plotting a graph in real-time without reading from a file

    Hello there.
    I am trying to plot a graph. I have succeeded in plotting the graph by first writing the data to a text file (.TXT), then reading from that text file.
    However, I feel this method will take up a lot of memory. Thus, I was wondering whether it is possible to plot the graph directly without first writing it to a text file.
    Thanks a million.

    You can use a while loop with a shift register, inside the while loop, put a case structure, and in it, your data aquisition vi. When you get data, use the shift register to append data to the array, using build array (the shift register will go in as an array, and data as an element) just execute the appending state when data is present, and you'll have a real time graph.
    Hope this helps

  • Diffference between reading from URL and reading using Sockets

    Hi,
    For my AJAX call, if the URL is out side my domain, then I am not able to get the js and css for that url.
    what can be the other approaches to resolve this issue?
    again, what is the difference between reading from URL / reading from a socket connection?
    Does AJAX call through socket solve my problem??
    Your input is appreciated.
    Thank you,
    Regards,
    Chintan

    Converting Between a Filename Path and a URL
    Copying One File to Another

  • Reading a file and changing one part of the file

    I am trying to read a file and then I want to change the first value on each line. The file I am reading is a .HEADER file. Which is just read in notepad I am just opening this like a txt file. I get no say at all how this file is created originally
    I want to change the value on the first line the a new title plus the ext .dat. The file is below. This stays the same format just with different values.
    ECG000 1 171 26112 9:14:56 23/04/2002
    ECG000 8 43(0) 8 127 79 -24066 0 AED trace
    I want to change the ECG000 to a new value eg Pat1.dat on the first line and Pat1 on the second line. When I read this file in and output to the dos window I get ECG000 0 0 0 and that is it. Any ideas why this is happening and how I can replace the values in the file??
         private void FileExt() throws IOException
              System.out.println("In function");
              BufferedReader br = new BufferedReader(new FileReader("c:\\Projects\\FirstSupport\\ECG000.HEADER"));
              String s;
              Vector data = new Vector();
              ECGFile = new FileWriter("c:\\Projects\\FirstSupport\\ECG.txt",true);
              System.out.println("Reading the file");
              while ((s = br.readLine()) != null)
              data.add(s);
              System.out.println(s);
              System.out.println("Finished");
              String label = s.substring(0, s.indexOf(" "));
              System.out.println(label);
              String newLabel = (label+".dat");
              System.out.println(newLabel);
         }

    I think this is what you're looking for:     private void FileExt() {
              java.util.List data=new ArrayList();
              String s;
              try {
                   BufferedReader br=new BufferedReader(new InputStreamReader(
                        new FileInputStream(new File("ECG000.HEADER"))));
                   while ((s = br.readLine()) != null)  {
                        data.add(s);
                        System.out.println(s);
                   br.close();
              catch (FileNotFoundException fnfe) {
                   System.out.println("Input file not found");
                   return;
              catch (IOException ioe) {
                   ioe.printStackTrace();
                   return;
              ListIterator li=data.listIterator();
              try {
                   PrintWriter ECGFile=new PrintWriter(new FileOutputStream(
                        new File("ECG.txt")));
                   while(li.hasNext()) {
                        s=(String)li.next();
                        if (s.substring(0, 6).equals("ECG000")) {
                             s="Pat1.dat"+s.substring(6, s.length());
                        ECGFile.println(s);
                   ECGFile.close();
              catch (FileNotFoundException fnfe1) {}
         }Mark

Maybe you are looking for

  • Recording audio from an external dj set up

    I have an old G4 desktop which has a 24 bit soundcard installed so I was able to plug in RCA jacks straight from the PCI soundcard to an external dj set up and record to my hard drive. I now have A G4 Powerbook -15" and I need to know how I can recor

  • The GRC Consultant

    In a regulated economy, success is measured on the speed, transparency, integrity and compliance capabilities of the organization’s business processes and  the system landscape. The key to success, would then translate into an effective audit of the

  • True Widescreen Video on iPod Classic

    Hi there, I have a new iPod classic and I've just put some videos on it. They are widescreen videos and they even show up as widescreen pics on their little thumbnails in the iPod's list of videos. However when I play them they are stretched to fit t

  • Synchronization of the lyrics on iPhone

    Hi everybody! I have a problem with the synchronization between iTunes and my iPhone3GS....I inserted the lyrics in some songs of my library but, after the synchronization, when I play the song on the iPhone there's no text. Can somebody help me?

  • Game mode swither, Won't switch!!! (X-

    I have just recently come across this problem, while switching to Game mode on my X-fi soundcard a message pops up that reads "You need to restart your computer before the new mode of your audio device will take effect. Do you want to restart your co