Editing and changing large text file

hi,
new to this, so bare with me.
got a large text file 44meg and i need to change some values in it.
example:
TSX ;20030102;40302216;40300579;1980;1900;3762000
i need to change the lines so that they read:
TSX ;20030102;302216;300579;1980;1900;3762000
thus removing the leading 40 in the middle cols.
Thanks in advance
john

crap, small mistake
1) use BufferedReader to read in the file line by line (BufferedReader.readLine())
2a) for each line, split it on the semicolons (String.split())
2b) change the middle value using String.substring()
2c) construct a new line by appending all strings in the array returned by 2a) to eachother
2d) write this new line to a file using PrintStream (PrintSteam.println())
3) when done, close both the reader and the printstream.

Similar Messages

  • I am working in text edit and cannot open my file. Error message says it is in the wrong format, truncated or corrupted. what to do?

    I am working in text edit and cannot open my file. Error message says it is in the wrong format, truncated or corrupted. what to do?

    Try opening Disk Utility in your Applications-Utilities folder and repair permissions.

  • Arbitrary waveform generation from large text file

    Hello,
    I'm trying to use a PXI 6733 card hooked up to a BNC 2110 in a PXI 1031-DC chassis to output arbitrary waveforms at a sample rate of 100kS/s.  The types of waveforms I want to generate are generally going to be sine waves of frequencies less than 10 kHz, but they need to be very high quality signals, hence the high sample rate.  Eventually, we would like to go up to as high as 200 kS/s, but for right now we just want to get it to work at the lower rate. 
    Someone in the department has already created for me large text files > 1GB  with (9) columns of numbers representing the output voltages for the channels(there will be 6 channels outputting sine waves, 3 other channels with a periodic DC voltage.   The reason for the large file is that we want a continuous signal for around 30 minutes to allow for equipment testing and configuration while the signals are being generated. 
    I'm supposed to use this file to generate the output voltages on the 6733 card, but I keep getting numerous errors and I've been unable to get something that works. The code, as written, currently generates an error code 200290 immediately after the buffered data is output from the card.  Nothing ever seems to get enqued or dequed, and although I've read the Labview help on buffers, I'm still very confused about their operation so I'm not even sure if the buffer is working properly.  I was hoping some of you could look at my code, and give me some suggestions(or sample code too!) for the best way to achieve this goal.
    Thanks a lot,
    Chris(new Labview user)

    Chris:
    For context, I've pasted in the "explain error" output from LabVIEW to refer to while we work on this. More after the code...
    Error -200290 occurred at an unidentified location
    Possible reason(s):
    The generation has stopped to prevent the regeneration of old samples. Your application was unable to write samples to the background buffer fast enough to prevent old samples from being regenerated.
    To avoid this error, you can do any of the following:
    1. Increase the size of the background buffer by configuring the buffer.
    2. Increase the number of samples you write each time you invoke a write operation.
    3. Write samples more often.
    4. Reduce the sample rate.
    5. Change the data transfer mechanism from interrupts to DMA if your device supports DMA.
    6. Reduce the number of applications your computer is executing concurrently.
    In addition, if you do not need to write every sample that is generated, you can configure the regeneration mode to allow regeneration, and then use the Position and Offset attributes to write the desired samples.
    By default, the analog output on the device does what is called regeneration. Basically, if we're outputting a repeating waveform, we can simply fill the buffer once and the DAQ device will reuse the samples, reducing load on the system. What appears to be happening is that the VI can't read samples out from the file fast enough to keep up with the DAQ card. The DAQ card is set to NOT allow regeneration, so once it empties the buffer, it stops the task since there aren't any new samples available yet.
    If we go through the options, we have a few things we can try:
    1. Increase background buffer size.
    I don't think this is the best option. Our issue is with filling the buffer, and this requires more advanced configuration.
    2. Increase the number of samples written.
    This may be a better option. If we increase how many samples we commit to the buffer, we can increase the minimum time between writes in the consumer loop.
    3. Write samples more often.
    This probably isn't as feasible. If anything, you should probably have a short "Wait" function in the consumer loop where the DAQmx write is occurring, just to regulate loop timing and give the CPU some breathing space.
    4. Reduce the sample rate.
    Definitely not a feasible option for your application, so we'll just skip that one.
    5. Use DMA instead of interrupts.
    I'm 99.99999999% sure you're already using DMA, so we'll skip this one also.
    6. Reduce the number of concurrent apps on the PC.
    This is to make sure that the CPU time required to maintain good loop rates isn't being taken by, say, an antivirus scanner or something. Generally, if you don't have anything major running other than LabVIEW, you should be fine.
    I think our best bet is to increase the "Samples to Write" quantity (to increase the minimum loop period), and possibly to delay the DAQmx Start Task and consumer loop until the producer loop has had a chance to build the queue up a little. That should reduce the chance that the DAQmx task will empty the system buffer and ensure that we can prime the queue with a large quantity of samples. The consumer loop will wait for elements to become available in the queue, so I have a feeling that the file read may be what is slowing the program down. Once the queue empties, we'll see the DAQmx error surface again. The only real solution is to load the file to memory farther ahead of time.
    Hope that helps!
    Caleb Harris
    National Instruments | Mechanical Engineer | http://www.ni.com/support

  • How to add header and fooder in text file

    Hi,
    i have created simple application for generate report from database into text file.
    But i need to add header and fooder in text file. I dont know is there any API for adding these.
    Can anyone help me to create header and fooder in text file.
    the below text are needs to be print in the header
    name of the table :
    Recorder type :
    file creation time:
    the below text are needs to be print in the footer
    Recorder Number:
    Record Type;
    the actual code is
                           pst = con.prepareStatement("select REQUEST, DOMAIN_NAME, TRUNC(DATE_OF_CONFIGURATION) AS dateofConfig  FROM employee where id=300");
                               rs = pst.executeQuery();
                            while (rs.next()) {
                                 request = rs.getString("REQUEST");
                                    domain_name = rs.getString("DOMAIN_NAME");
                                    dateofconfig = rs.getString("dateofConfig");
                                    System.out.println(request + " " + domain_name + " " + dateofconfig);
                                   data.add(request + " " + domain_name + " " + dateofconfig);
                            System.out.println("before calling method");
                            writeToFile(data, "c:/Employee.txt");
                            System.out.println("file created successfull");
                            rs.close();
                            pst.close();
           private static void writeToFile(List list, String path) {
                    BufferedWriter out = null;
                    try {
                            File file = new File(path);
                            out = new BufferedWriter(new FileWriter(file, true));
                            for (Object obj : list) {
                                String s=  obj.toString(); 
                                 out.write(s);
                                    out.newLine();
                            out.close();
                    } catch (IOException e) {
    }Thanks
    Jasmin
    Edited by: user13836688 on Mar 21, 2011 4:06 AM
    Edited by: user13836688 on Mar 21, 2011 4:07 AM
    Edited by: user13836688 on Mar 21, 2011 4:08 AM

    user13836688 wrote:
    i have created simple application for generate report from database into text file.First off, when posting code, use &#91;code]...&#91;/code]. or '' tags, not '<code>'.
    But i need to add header and fooder in text file. I dont know is there any API for adding these.
    Can anyone help me to create header and fooder in text file.Well you plainly have the code to write the file contents; and furthermore your report seems to be contained in a List called 'data'. Why not just add the header and footer lines to it? I'd also suggest making 'data' a LinkedList. That way you can add the header afterwards with no performance hit, just in case the information it contains isn't available at the start of your report loop.
    Winston                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • I want to use my Time Capsule as a central 'hub/hard-drive' in order to keep all my working files in one place. I then plan to use my laptops/desktops as peripheral devices for editing and creation of these files. Is it possible? Create a personal cloud?

    I want to use my Time Capsule as a central 'hub/hard-drive' in order to keep all my working files in one place. I then plan to use my laptops/desktops as peripheral devices for editing and creation of these files. Is it possible? To create a personal cloud?
    Can someone advise as to whether i can do the following:
                                Future Internet connection -------------------TIME CAPSULE (containing all files) -------------- Backed up on the WD 2T Hard-drive I have
                                      (not connected yet)                                         I                                                          (*connected to timecapsule physically)
                                                                                                            I
                    I                                         I                                                I                                                              I                                                I
          Macbook Pro                             iMac                                       HP (PC)                                             OLD Macbook Pro                         iPhone
    (used for remote working)       (Used for home working)     (used for heavy CAD and rendering)    (not being used for anything at the moment)        (& iPods)
    I am looking to have all my files in one place as i am hopelessly disorganised. I know the online clouds are a good solution (used Dropbox at work and uni for 3 years) however i am wanting to create my own 'dropbox/icloud' at home. So whenever i get back home with my laptop, any work i have been working on whilst out that day is updated to the timecapsule, and then ultimately as i turn on the other devices, they update to those newer versions of the files. Please tell me that the 3TB time capsule i have can do this, otherwise it feels rather overpriced as a wireless storage device?
    Another note (to those in the know) If i am to be working on large files (REVIT/SOLIDWORKS/KEYSHOT/CREO/AUTOCAD) - is the timecapsule connection good enough to support editing and updating these files?
    I know i may be asking a question that many have before, but as a bit of a technical novice I wanted a clear-cut answer to my specific circumstances. Your help is greatly appreciated.
    (*can i use this WD hard-drive that is connected to the Time Capsule as a back up? so that the time machine back-ups/any back ups are also backed up onto this one? can the WD be a backup for the TC?)
    Kind Regards
    Joe

    The diagram was supposed to look more like this......
    Internet ---------TIME CAPSULE(containing all files) --------WD 2T Harddrive
                                                I
         I                           I                          I                            I                                   I
    Macbook Pro         iMac                 HP (PC)            OLD Macbook Pro           iPhone
    Sorry!
    Regards
    Joe

  • How to load date and time from text file to oracle table through sqlloader

    hi friends
    i need you to show me what i miss to load date and time from text file to oracle table through sqlloader
    this is my data in this path (c:\external\my_data.txt)
    7369,SMITH,17-NOV-81,09:14:04,CLERK,20
    7499,ALLEN,01-MAY-81,17:06:08,SALESMAN,30
    7521,WARD,09-JUN-81,17:06:30,SALESMAN,30
    7566,JONES,02-APR-81,09:24:10,MANAGER,20
    7654,MARTIN,28-SEP-81,17:24:10,SALESMAN,30my table in database emp2
    create table emp2 (empno number,
                      ename varchar2(20),
                      hiredate date,
                      etime date,
                      ejob varchar2(20),
                      deptno number);the control file code in this path (c:\external\ctrl.ctl)
    load data
    infile 'C:\external\my_data.txt'
    into table emp2
    fields terminated by ','
    (empno, ename, hiredate, etime, ejob, deptno)this is the error :
    C:\>sqlldr scott/tiger control=C:\external\ctrl.ctl
    SQL*Loader: Release 10.2.0.1.0 - Production on Mon May 31 09:45:10 2010
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Commit point reached - logical record count 5
    C:\>any help i greatly appreciated
    thanks
    Edited by: user10947262 on May 31, 2010 9:47 AM

    load data
    infile 'C:\external\my_data.txt'
    into table emp2
    fields terminated by ','
    (empno, ename, hiredate, etime, ejob, deptno)Try
    load data
    infile 'C:\external\my_data.txt'
    into table emp2
    fields terminated by ','
    (empno, ename, hiredate, etime "to_date(:etime,'hh24:mi:ss')", ejob, deptno)
    this is the error :
    C:\>sqlldr scott/tiger control=C:\external\ctrl.ctl
    SQL*Loader: Release 10.2.0.1.0 - Production on Mon May 31 09:45:10 2010
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Commit point reached - logical record count 5
    C:\>
    That's not an error, you can see errors within log and bad files.

  • I have a PDF with a diagram, I need to translate the text so I open it in Illustrator.  The document opnes up vertically oriented  I try to put it horizontal to be able to read and change the text  However everything I have done is not working  The artboa

    I have a PDF with a diagram, I need to translate the text so I open it in Illustrator.  The document opens up vertically oriented  I try to put it horizontal to be able to read and change the text  However everything I have done is not working  The artboard does change, but the diagram stays vertical.....Please help  I need to finish that for today..Please help

    A PDF usually consists of one to an indefinite number of clipping masks inside each other.
    You need to be very carefull with selecting stuff.
    So you need to read the manual on how to select stuff and on the basics of Illustrator.
    On top of that: because of the complex hierarchy of PDF files, it is kind of difficult to help you without seeing anything.

  • How can I edit and save a raw file in jpeq and open it in windows live photo gallery

    how can I edit and save a raw file in ps elements 10 and open it in windows live photo gallery?

    Change to 8 bit mode before clicking the Open Image button, then jpeg will become available as a choice.
    Click to view image

  • Sorting of a large text file

    I am rewriting a UNIX script to Java. The UNIX script has syncsort code contained in it. The sort is used to sort large text files. The files consist of very large records, up to 3000 characters. I have the file layouts for the fields within the records. Below are a couple syncsorts showing what I need to re-write.
    The first sort, sorts the file by transaction type and only keeps certain transaction types.
    $SYNCSORT << ____endsort1
    /WARNING 1 /SKIPBLANK
    /INFILE $XJOB/tran.ACHP
    /OUTFILE $XJOB/tran.ACHP.careabout
    /FIELDS tran 1 CHAR 3, seq 4 CHAR 2, check_field 9 CHAR 1
    /CONDITION CARE_ABOUT ((tran="104" OR tran="154" OR tran="165" OR tran="301" OR tran="385") AND (seq="00" OR seq="01")) OR (tran="104" AND check_field !="$")
    /COPY
    /INCLUDE CARE_ABOUT
    /END
    endsort1
    The second sort. sorts by plan number, participant number in ascending order and summarizes the amount. I can summarize the amount after the sort in Java so that does not need to be done in the same sort step.
    $SYNCSORT << ____endsort2
    /WARNING 1 /SKIPBLANK
    /INFILE $XJOB/extract.ACHP
    /FIELDS plan 1 CHAR 6, amount 8 TS 15, partid 23 CHAR 9
    /KEYS plan, partid ASCENDING
    /SUMMARIZE TOTAL amount
    /OUTFILE $XJOB/extract.ACHP.summary
    /END
    endsort2
    What is the best way to read in the file, store the data, i.e. vector or array, and how would I go about sorting a large file with very long records?
    Much thanks in advance!!!

    try looking at the comparable interface and the collections.sort() methods. maybe they will save u a little work. as for using arrays or vectors i would use arraylists/vectors so i could use the collections methods. and for the rest of it, it will depend more on your exact needs and i guess you'll just have to go about and make your own configuration systems etc.. shouldnt be too tuff.

  • Loading, processing and transforming Large XML Files

    Hi all,
    I realize this may have been asked before, but searching the history of the forum isn't easy, considering it's not always a safe bet which words to use on the search.
    Here's the situation. We're trying to load and manipulate large XML files of up to 100MB in size.
    The difference from what we have in our hands to other related issues posted is that the XML isn't big because it has a largly branched tree of data, but rather because it includes large base64-encoded files in the xml itself. The size of the 'clean' xml is relatively small (a few hundred bytes to some kilobytes).
    We had to deal with transferring the xml to our application using a webservice, loading the xml to memory in order to read values from it, and now we also need to transform the xml to a different format.
    We solved the webservice issue using XFire.
    We solved the loading of the xml using JAXB. Nevertheless, we use string manipulations to 'cut' the xml before we load it to memory - otherwise we get OutOfMemory errors. We don't need to load the whole XML to memory, but I really hate this solution because of the 'unorthodox' manipulation of the xml (i.e. the cutting of it).
    Now we need to deal with the transofmation of those XMLs, but obviously we can't cut it down this time. We have little experience writing XSL, but no experience on how to use Java to use the XSL files. We're looking for suggestions on how to do it most efficiently.
    The biggest problem we encounter is the OutOfMemory errors.
    So I ask several questions in one post:
    1. Is there a better way to transfer the large files using a webservice?
    2. Is there a better way to load and manipulate the large XML files?
    3. What's the best way for us to transform those large XMLs?
    4. Are we missing something in terms of memory management? Is there a better way to control it? We really are struggling there.
    I assume this is an important piece of information: We currently use JDK 1.4.2, and cannot upgrade to 1.5.
    Thanks for the help.

    I think there may be a way to do it.
    First, for low RAM needs, nothing beats SAX. as the first processor of the data. With SAX, you control the memory use since SAX only processes one "chunk" of the file at a time. You supply a class with methods named startElement, endElement, and characters. It calls the startElement method when it finds a new element. It calls the characters method when it wants to pass you some or all of the text between the start and end tags. It calls endElement to signal that passing characters is over, and to let you get ready for the next element. So, if your characters method did nothing with the base-64 data, you could see the XML go by with low memory needs.
    Since we know in your case that the characters will process large chunks of data, you can expect many calls as SAX calls your code. The only workable solution is to use a StringBuffer to accumulate the data. When the endElement is called, you can decode the base-64 data and keep it somewhere. The most efficient way to do this is to have one StringBuffer for the class handling the SAX calls. Instantiate it with a big enough size to hold the largest of your binary data streams. In the startElement, you can set the length of the StringBuilder to zero and reuse it over and over.
    You did not say what you wanted to do with the XML data once you have processed it. SAX is nice from a memory perspective, but it makes you do all the work of storing the data. Unless you build a structured set of classes "on the fly" nothing is kept. There is a way to pass the output of one SAX pass into a DOM processor (without the binary data, in this case) and then you would wind up with a nice tree object with the rest of your data and a group of binary data objects. I've never done the SAX/DOM combo, but it is called a SAXFilter, and you should be able to google an example.
    So, the bottom line is that is is very possible to do what you want, but it will take some careful design on your part.
    Dave Patterson

  • Accept all editions and changes with one click in a PDF document

    In Adobe Acrobat (7.09) I see how to accept changes in a PDF document individually, but is is possible to accept all editions and changes with one click, as it is in Word for example. For tips thanks in advance.

    Hi,
    To save usernames/passwords, you may have to make sure that '''Remember passwords for sites''' is still enabled in '''Tools''' ('''Alt''' + '''T''') > '''Options''' > '''Security''' while at the same time in the '''Privacy''' tab, '''Never remember history''' or '''Always use Private Browsing''' shouldn't be enabled and if '''Settings''' is visible here, make sure that '''Saved Passwords''' is not enabled (ticked).
    [https://support.mozilla.org/en-US/kb/Options%20window%20-%20Security%20panel?as=u Security panel]
    [https://support.mozilla.org/en-US/kb/Options%20window%20-%20Privacy%20panel?as=u Privacy panel]

  • How to list the contents of an OSX directory, and output to text file?

    hello there any hints with any known program that does following
    I have recorded my music directory to DVD and now i would like to make an .txt file what the dvd contains...cos its way of hand to write all 100xx files by hand...
    How to list the contents of an OSX directory, and output to text file?
    any prog that does that? any hints?
    best regards

    This script makes a hierarchical file listing all files in a folder and subfolder:
    Click here to launch Script Editor.
    choose folder with prompt "Choose a folder to process..." returning theFolder
    set theName to name of (info for theFolder)
    set thepath to quoted form of POSIX path of theFolder
    set currentIndex to theFolder as string
    do shell script "ls -R " & thepath returning theDir
    set theDirList to every paragraph of theDir
    set newList to {"Contents of folder \"" & theName & "\"" & return & thepath & return & return}
    set theFilePrefix to ""
    repeat with i from 1 to count of theDirList
    set theLine to item i of theDirList
    set my text item delimiters to "/"
    set theMarker to count of text items of thepath
    set theCount to count of text items of theLine
    set currentFolder to text item -1 of theLine
    set theFolderPrefix to ""
    if theCount is greater than theMarker then
    set theNestIndex to theCount - theMarker
    set theTally to -1
    set theFilePrefix to ""
    set theSuffix to ""
    repeat theNestIndex times
    set theFolderPrefix to theFolderPrefix & tab
    set theFilePrefix to theFilePrefix & tab
    if theTally is -1 then
    set theSuffix to text item theTally of theLine & theSuffix
    else
    set theSuffix to text item theTally of theLine & ":" & theSuffix
    end if
    set currentIndex to "" & theFolder & theSuffix
    set theTally to theTally - 1
    end repeat
    end if
    set my text item delimiters to ""
    if theLine is not "" then
    if word 1 of theLine is "Volumes" then
    set end of newList to theFolderPrefix & "Folder: > " & currentFolder & return
    else
    try
    if not folder of (info for alias (currentIndex & theLine & ":")) then
    set end of newList to theFilePrefix & tab & tab & tab & "> " & theLine & return
    end if
    end try
    end if
    end if
    end repeat
    open for access file ((path to desktop as string) & "Contents of folder- " & theName & ".txt") ¬
    with write permission returning theFile
    write (newList as string) to theFile
    close access theFile

  • ALE, IDOC - need to send IDOC and create a text file

    Hi,
    i need to send idoc to some other system and create a text file in that.
    I want sent data to Channel Cluster.
    what are the settings required for that in transactions
    BD54
    SCC4
    SM59 - which connection is required
    WE21 - which type of port
    WE20 - which partner
    BD64
    Is there any other function modules required.
    which function module is suitable like MASTER_IDOC_DISTRIBUTE.

    Hi,
    SM59 - Use TCP/IP Connection with connection type 'T'
    WE20 - Partner Name can be logical system name, if it is a vendor/customer you can configure it under the respective names.
    Thanks
    Krithika

  • Way to edit and save .AC3 audio files?

    Anyone know if there is a way to edit and save .AC3 audio files in Audition 3?

    Every time you open any coded file at all in Audition, you lose quality if you resave it in anything other than an uncompressed format. With most formats, what is even worse is saving them in a different compressed format, because you end up with twice as many different coding artefacts.
    What you need to understand is that all of these formats are distribution formats, not editing ones. The basic principle is that you work in an uncompressed format until the last possible moment - ie, distribution. And that, ideally, is the only time you use a compressed format at all. So if you want to use something that's compressed, you uncompress it once, and don't recompress until you absolutely have to.

  • I need to upload edit and change blueprints, what should i get

    What should i get to upload edit and change blueprints

    Sorry, this question is way too generic. "Edit and change" can mean a million things. what are the blueprints based on? What changes do you need to make?
    Mylenium

Maybe you are looking for