Importing fixed width text from a .txt file

I am really struggling to do in Numbers '09 something which I can do easily in Excel.
I have a txt file containing plain text in fixed-width columns which I would like to import into numbers.
I just cannot find a way to do it.
I have tried using the Insert/choose menu item - but it won't take .txt files.
I have tried to copy/paste the data, but it get's pasted into a single column.
The data consists of many lines like this:
Part Value Device Package Library Sheet
A-IN JST-2.0-4 JST-2.0-4 JST-20M KMILLAR 1
A-IN JST-2.5-4 JST-2.5-4 JST-25M KMILLAR 1
A-IN JST-2.8-4 JST-2.8-4 JST-28M KMILLAR 1
(and so on....)
(Each column is an exact number of characters wide, but these forums make that hard to see due to the variable spaced fonts).
How can I import this data into numbers?
(Sorry, but I cannot get the data in any other format, such as CSV, the application which exports it only support fixed width colums with spaces for padding).
Many thanks in advance,
Kenny

Here is a script treating the case of fixed widths values.
--[SCRIPT fixedwidth_values_toTSV.scpt]
Enregistrer le script en tant que Script : fixedwidth_values_toTSV.scpt
déplacer le fichier ainsi créé dans le dossier
<VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Numbers:
Il vous faudra peut-être créer le dossier Numbers et peut-être même le dossier Applications.
aller au menu Scripts , choisir Numbers puis choisir fixedwidth_values_toTSV
Choisir un fichier texte.
Le script détermine la largeur des différentes colonnes puis remplace les groupes séparateurs par des caractères TAB.
Le résultat est passé dans le presse-paiers et est enregistré à la place du contenu initial.
Vous pouvez alors
(1) coller dans le document de votre choix
(2) ouvrir le fichier texte modifié dans Numbers qui accepte sans broncher les ficiers .txt.
Utilisation alternative : enregistrer le script en tant que Progiciel (Application sous 10.6.x)
Glisser-déposer l'icône d'un fichier texte sur celle de l'application lancera le traitement voulu.
--=====
L'aide du Finder explique:
L'Utilitaire AppleScript permet d'activer le Menu des scripts :
Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
Cochez la case "Afficher le menu des scripts dans la barre de menus".
Sous 10.6.x,
aller dans le panneau "Général" du dialogue Préférences de l'Éditeur Applescript
puis cocher la case "Afficher le menu des scripts dans la barre des menus".
--=====
Save the script as a Script: fixedwidth_values_toTSV.scpt
Move the newly created file into the folder:
<startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
Maybe you would have to create the folder Numbers and even the folder Applications by yourself.
go to the Scripts Menu, choose Numbers, then choose "fixedwidth_values_toTSV"
Choose a text file.
The script scan the file's contents to extract the width of every column then it replace the separator groups by TAB characters.
The result is passed to the clipboard and is written in the original file.
So you may :
(1) paste in the document of your choice
(2) open the modified text file with Numbers which is fair enough to do that.
An alternate track is to save the script as an Application Package (Application under 10.6.x)
Drag and drop the icon of a text file on the application's one will do the job.
--=====
The Finder's Help explains:
To make the Script menu appear:
Open the AppleScript utility located in Applications/AppleScript.
Select the "Show Script Menu in menu bar" checkbox.
Under 10.6.x,
go to the General panel of AppleScript Editor’s Preferences dialog box
and check the “Show Script menu in menu bar” option.
--=====
Yvan KOENIG (VALLAURIS, France)
2010/08/19
--=====
on run
set un_fichier to choose file with prompt "Choose e text file…" of type {"public.plain-text"} without invisibles
my commun(un_fichier)
end run
--=====
on open (sel)
set un_fichier to item 1 of sel
tell application "System Events" to set type_ID to type identifier of disk item ("" & un_fichier)
if type_ID is "public.plain-text" then my commun(un_fichier as alias)
error "The file “" & un_fichier & "” isn’t a text file !"
end open
--=====
on commun(le_fichier)
set le_contenu to read le_fichier
set le_contenu to "azer ertyuio wxcv dfghj
qszaed dc fghj mlkjhgf nbvcxw
aqwzsx edcrfv tg byhn aaaaaaa "
set listedelistes to {}
set plusgrandelongueur to 0
set pluspetitelongueur to 999999
set listelignesbrutes to paragraphs of le_contenu
repeat with refd_uneligne in listelignesbrutes
set maybe to contents of refd_uneligne
set maybe2 to count of maybe
if maybe2 > plusgrandelongueur then set plusgrandelongueur to maybe2
if maybe2 < pluspetitelongueur then set pluspetitelongueur to maybe2
copy my decoupe(maybe, space) to end of listedelistes
end repeat
set differencedelongueur to plusgrandelongueur - pluspetitelongueur
set des_espaces to space
repeat differencedelongueur times
set des_espaces to des_espaces & space
end repeat
set largeur1 to 0
repeat with refd_uneligne in listedelistes
set maybe to length of first item of refd_uneligne
if maybe > largeur1 then set largeur1 to maybe
end repeat
set liste_finale to {}
repeat with refd_uneligne in listelignesbrutes
set maybe to contents of refd_uneligne
set maybe2 to text 1 thru largeur1 of maybe
repeat while maybe2 ends with space
set maybe2 to text 1 thru -2 of maybe2
end repeat
copy maybe2 to end of liste_finale
copy text (largeur1 + 2) thru plusgrandelongueur of (maybe & des_espaces) to contents of refd_uneligne
end repeat
Enter the bigger loop *)
set cest_Lafin to false
repeat
Deprieve the stored rows of the treated column's items *)
set flag to 0
repeat
set flag to flag + 1
set flag2 to 0
repeat with refd_uneligne in listelignesbrutes
if "" & character flag of contents of refd_uneligne is space then set flag2 to flag2 + 1
end repeat
if flag2 < (count of listelignesbrutes) then exit repeat
end repeat
repeat with refd_uneligne in listelignesbrutes
copy text flag thru -1 of contents of refd_uneligne to contents of refd_uneligne
end repeat
Prepare the extraction of next column *)
repeat with refd_uneligne in listelignesbrutes
copy my decoupe(contents of refd_uneligne, space) to end of listedelistes
end repeat
Extract the width of the column to treat *)
set largeur1 to 0
repeat with refd_uneligne in listedelistes
set maybe to length of first item of refd_uneligne
if maybe > largeur1 then set largeur1 to maybe
end repeat
Extract the column's values *)
repeat with i from 1 to count of listelignesbrutes
set maybe to contents of item i of listelignesbrutes
set maybe2 to text 1 thru largeur1 of maybe
repeat while maybe2 ends with space
set maybe2 to text 1 thru -2 of maybe2
end repeat
copy (contents of item i of liste_finale) & tab & maybe2 to item i of liste_finale
try
copy text (largeur1 + 2) thru -1 of maybe to item i of listelignesbrutes
on error
set cest_Lafin to true
end try
end repeat -- i
if cest_Lafin then exit repeat
end repeat -- bigger loop
set le_contenu to my recolle(liste_finale, return)
set the clipboard to le_contenu
set eof of le_fichier to 0
write le_contenu to le_fichier
end commun
--=====
on decoupe(t, d)
local oTIDs, l
set oTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to d
set l to text items of t
set AppleScript's text item delimiters to oTIDs
return l
end decoupe
--=====
on recolle(l, d)
local oTIDs, t
set oTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to d
set t to l as text
set AppleScript's text item delimiters to oTIDs
return t
end recolle
--=====
--[/SCRIPT]
Yvan KOENIG (VALLAURIS, France) vendredi 20 août 2010 12:44:33

Similar Messages

  • Importing Text From A .txt File

    Hey guys,
    I'm looking for a way to import text from a .txt file but I'm totally lost. If someone could point me in the right direction that would be awesome

    Hi Prails
    This script is basically what you asked:
    #target illustrator
    #targetengine main
    function copyText(){
        var textFile = File.openDialog ("Select the file");
        if (! textFile.exists || app.documents.length==0){
            return;
        textFile.open("r");
        var txtContent = textFile.read();
        textFile.close();
        var doc = app.activeDocument;
        var textItem = doc.textFrames.add();
        textItem.contents = txtContent   
    copyText ();
    Basically what you need to do is declare the text file, open it, read the content and close it. Then, you create a new text item in the Illustrator document and write the content once catched into the text item.
    You could continue to work with the variable "textItem" in my example script if you want to set properties like the size, color of the text, position and so on. Also, if you want, replace the first line of the function var textFile = new File ("~/Desktop/Test.txt"); by var textFile = File.openDialog ("Select the file"); so the scripts opens a dialog to ask you the file you want the copy the content.
    Hope to be helped
    Best Regards
    Gustavo
    Message was edited by: Gustavo Del Vechio

  • Loading text from a .txt file

    I want to do something that should be VERY simple, but due to
    Adobe's insistence on using #$%^ing tutorials instead of just
    providing step by step instructions, it's very frustrating to
    figure out how to do it.
    All I want to do is load the contents of a text file into a
    dynamic text field, but I can't figure out how to do it (I'm not
    all that familiar with AS). I'm working with Flash 8. Please help.
    Thanks.

    Create the dynamic text box, and name it schedule.
    Then, in the frame on the timeline that the text box resides
    in, the corresponding actionscript would be used to create a text
    variable and assign the text from a txt file to it:
    loadText = new LoadVars();
    loadText.load("externalfile.txt");
    loadText.onLoad = function() {
    schedule.text = this.textbody;
    Where does the "textbody" variable come from? In the external
    text file (externalfile.txt in this example), you have a variable
    called textbody, and the externalfile.txt should read along the
    lines of:
    textbody = "I'm the external text that needs to be read
    in"

  • How to use automator to extract specific text from json txt file

    I'm trying to set up an Automator folder action to extract certain data from json files. I'm pulling metadata from YouTube videos, and I want to extract the Title of the video, the URL for the video, and the date uploaded.
    Sample json data excerpts:
    "upload_date": "20130319"
    "title": "[title of varying length]"
    "webpage_url": "https://www.youtube.com/watch?v=[video id]"
    Based on this thread, seems I should be able to have Automator (or any means of using a shell script) find data and extract it into a .txt file, which I can then open as a space delimited file in Excel or Numbers. That answer assumes a static number of digits for the text to be extracted, though. Is there a way Automator can search through the json file and extract the text - however long - after "title" and "webpage_url"?
    json files are all in the same folder, and all end in .info.json.
    Any help greatly appreciated!

    Hello
    You might try the following perl script, which will process every *.json file in current directory and yield out.csv.
    * CSV currently uses space for field separator as you requested. Note that Numbers.app cannot import such CSV file correctly.
    #!/bin/bash
    /usr/bin/perl -CSDA -w <<'EOF' - *.json > out.csv
    use strict;
    use JSON::Syck;
    $JSON::Syck::ImplicitUnicode = 1;
    # json node paths to extract
    my @paths = ('/upload_date', '/title', '/webpage_url');
    for (@ARGV) {
        my $json;
        open(IN, "<", $_) or die "$!";
            local $/;
            $json = <IN>;
        close IN;
        my $data = JSON::Syck::Load($json) or next;
        my @values = map { &json_node_at_path($data, $_) } @paths;
            #   output CSV spec
            #   - field separator = SPACE
            #   - record separator = LF
            #   - every field is quoted
            local $, = qq( );
            local $\ = qq(\n);
            print map { s/"/""/og; q(").$_.q("); } @values;
    sub json_node_at_path ($$) {
        #   $ : (reference) json object
        #   $ : (string) node path
        #   E.g. Given node path = '/abc/0/def', it returns either
        #       $obj->{'abc'}->[0]->{'def'}   if $obj->{'abc'} is ARRAY; or
        #       $obj->{'abc'}->{'0'}->{'def'} if $obj->{'abc'} is HASH.
        my ($obj, $path) = @_; 
        my $r = $obj;
        for ( map { /(^.+$)/ } split /\//, $path ) {
            if ( /^[0-9]+$/ && ref($r) eq 'ARRAY' ) {
                $r = $r->[$_];
            else {
                $r = $r->{$_};
        return $r;
    EOF
    For Automator workflow, you may use Run Shell Script action as follows, which will receive json files and yield out_YYYY-MM-DD_HHMMSS.csv on desktop.
    Run Shell Script action
        - Shell = /bin/bash
        - Pass input = as arguments
        - Code = as follows
    #!/bin/bash
    /usr/bin/perl -CSDA -w <<'EOF' - "$@" > ~/Desktop/out_"$(date '+%F_%H%M%S')".csv
    use strict;
    use JSON::Syck;
    $JSON::Syck::ImplicitUnicode = 1;
    # json node paths to extract
    my @paths = ('/upload_date', '/title', '/webpage_url');
    for (@ARGV) {
        my $json;
        open(IN, "<", $_) or die "$!";
            local $/;
            $json = <IN>;
        close IN;
        my $data = JSON::Syck::Load($json) or next;
        my @values = map { &json_node_at_path($data, $_) } @paths;
            #   output CSV spec
            #   - field separator = SPACE
            #   - record separator = LF
            #   - every field is quoted
            local $, = qq( );
            local $\ = qq(\n);
            print map { s/"/""/og; q(").$_.q("); } @values;
    sub json_node_at_path ($$) {
        #   $ : (reference) json object
        #   $ : (string) node path
        #   E.g. Given node path = '/abc/0/def', it returns either
        #       $obj->{'abc'}->[0]->{'def'}   if $obj->{'abc'} is ARRAY; or
        #       $obj->{'abc'}->{'0'}->{'def'} if $obj->{'abc'} is HASH.
        my ($obj, $path) = @_; 
        my $r = $obj;
        for ( map { /(^.+$)/ } split /\//, $path ) {
            if ( /^[0-9]+$/ && ref($r) eq 'ARRAY' ) {
                $r = $r->[$_];
            else {
                $r = $r->{$_};
        return $r;
    EOF
    Tested under OS X 10.6.8.
    Hope this may help,
    H

  • Fixed width field format in txt file

    I want to create text file for sending to bank. Every row in the text file is of variable length. For Ex: 1st row contains name and a fixed length of 33 char. 2nd row contains company and fixed length of 12 char.
    Howewer when i download the data using GUI_DOWNLOAD it is taking the row with full length i.e. 256 char that of the internal table line.
    If I use the truncate trailing blanks parameter, it removes all the spaces that are on the right of the name. what is our requirement is that irrespective of whatever is the actual length of the name it should take only 33 characters in first row. (ie If i place cursor on first character and press END button on keypad the cursor must move to 34 char).
    But at present what is happening is that it is either moving to the actual end of the name or column 256 ie the end of line.
    Any help to this will be highly appreciated.

    You have to move the contents to a string variable. Put the Line feed(cl_abap_char_utilities=>newline) or CR_LF (cl_abap_char_utilities=>dr_lf) at the offset as required by you.
    Download the file as 'BIN' using GUI_DOWNLOAD. You have to pass the length as the length of the string variable.
    Try this & come back if you have any doubts.
    BR,
    Suhas

  • Importing accents from a txt file

    Hi everyone
    I have the following proble that I can't solve for now:
    I've got a pdf file with forms
    I've got an excel file that I export to txt (tab delimited text file)
    When I import the data from the txt file to the pdf everything is fine but the french accents (é or è or à). For example the "é" becomes a " ,".
    I thinks it might be related to unicode or utf but I don't know how to export properly then import those characters.
    Any idea ?
    Thanks
    Florent
    PS: I'm using Excell 2011 on MAC and Acrobat 9 Pro.

    Done that already, no luck.
    I've saved in all the txt formats possible in my Excel.

  • Importing Arabic text from an XML file

    Importing text from an XML file to appear as text in Flash
    works in English, however if the text I want to import is in
    Arabic, when I test the movie there is no text at all.
    Is there some particular syntax to preface the Arabic text?
    I'll want to import text from XML in other languages too.
    (French)
    I'd cut and pasted some Arabic text into the XML file that
    displays pictures and text in the "slideshow.fla" (
    http://www.adobe.com/support/flash/applications/jpeg_slideshow_xml/jpeg_slideshow_xml03.ht ml)
    Substituting Arabic text for English text, editing the XML
    file with Dreamweaver.
    Any ideas as to how I might achieve my objective of importing
    Arabic text into Fash?
    I'd started developing my prototpe in Macromedia Director 7,
    and then Director MX, but I have not found a suitable Arabic font
    that I can embed that will allow me to display Arabic fonts in
    Adobe Director. I have the Arabic text in a Word document.
    I've dicovered that my Flash MX Pro and Dreamweaver both
    support Arabic fonts, but I want to import text from an XML file.
    I'd prefer using cast libraries and cast members, but I don't
    know of an equivalent in Flash to what I'm comfortable with in
    Director.

    Oh so many questions. You probably aren't going to like the
    answers. I have Flash MX04 pro (aka Flash 7) and things made a big
    jump between MX (aka 6) and MX04. If you only have MX, there might
    not be a way to do this. All my advice is based upon MX04 or
    higher.
    It is possible to do complex languages in Flash. My
    experience is with Hindi and I've helped a few folks here with
    Arabic.
    You won't be able to use text from Microsoft Word – at
    least I don't think so. The XML file will need to be saved in the
    UTF-8 format. I think Word uses its own scheme and won't work. But
    I'm not a Word expert. Something like Text Edit (Mac) or WordPad
    (PC) should be able to save a UTF-8 file.
    The next problem is you mention "suitable Arabic font that I
    can embed." AFAIK, you can't embed any of the complex scripts in
    Flash. You just have to rely on the end user having appropriate
    fonts installed and enabled. Most operating systems from 2000 on do
    have this – although some folks like to remove them to save
    space.
    Next issue will be line composing. I've found that when using
    anything above the normal Latin range that Flash suddenly forgets
    how to make a line fit into a text area. It will just break things
    in the middle of words and not even notice the spaces between
    words. I've written a little snippet of code that "composes" the
    lines. It works well with Hindi and folks here have used it with
    Arabic and not come back saying that it doesn't work. Search the
    forums (both the Flash and Actionscript) if you can't find it I'll
    dig it out when I get home.
    So here is the checklist:
    Make sure the XML is saved in UTF-8
    Import the XML file
    In Testing environment go Debug–>List variables.
    Does it show up correctly there?
    Does it show at all in a text field?
    Use the "composer" to make the lines break.

  • I have a VI and an attched .txt data file. Now I want to read the data from the .txt file and display it as an array in the front panel. But the result is not right. Any help?

    I have a VI and an attched .txt data file. Now I want to read the data from the .txt file and display it as an array in the front panel. But the result is not right. Any help?
    Attachments:
    try2.txt ‏2 KB
    read_array.vi ‏21 KB

    The problem is in the delimiters in your text file. By default, Read From Spreadsheet File.vi expects a tab delimited file. You can specify a delimiter (like a space), but Read From Spreadsheet File.vi has a problem with repeated delimiters: if you specify a single space as a delimiter and Read From Spreadsheet File.vi finds two spaces back-to-back, it stops reading that line. Your file (as I got it from your earlier post) is delimited by 4 spaces.
    Here are some of your choices to fix your problem.
    1. Change the source file to a tab delimited file. Your VI will then run as is.
    2. Change the source file to be delimited by a single space (rather than 4), then wire a string constant containing one space to the delimiter input of Read From Spreadsheet File.vi.
    3. Wire a string constant containing 4 spaces to the delimiter input of Read From Spreadsheet File.vi. Then your text file will run as is.
    Depending on where your text file comes from (see more comments below), I'd vote for choice 1: a tab delimited text file. It's the most common text output of spreadsheet programs.
    Comments for choices 1 and 2: Where does the text file come from? Is it automatically generated or manually generated? Will it be generated multiple times or just once? If it's manually generated or generated just once, you can use any text editor to change 4 spaces to a tab or to a single space. Note: if you want to change it to a tab delimited file, you can't enter a tab directly into a box in the search & replace dialog of many programs like notepad, but you can do a cut and paste. Before you start your search and replace (just in the text window of the editor), press tab. A tab character will be entered. Press Shift-LeftArrow (not Backspace) to highlight the tab character. Press Ctrl-X to cut the tab character. Start your search and replace (Ctrl-H in notepad in Windows 2000). Click into the Find What box. Enter four spaces. Click into the Replace With box. Press Ctrl-V to paste the tab character. And another thing: older versions of notepad don't have search and replace. Use any editor or word processor that does.

  • How to extract text from a PDF file?

    Hello Suners,
    i need to know how to extract text from a pdf file?
    does anyone know what is the character encoding in pdf file, when i use an input stream to read the file it gives encrypted characters not the original text in the file.
    is there any procedures i should do while reading a pdf file,
    File f=new File("D:/File.pdf");
                   FileReader fr=new FileReader(f);
                   BufferedReader br=new BufferedReader(fr);
                   String s=br.readLine();any help will be deeply appreciated.

    jverd wrote:
    First, you set i once, and then loop without ever changing it. So your loop body will execute either 0 times or infinitely many times, writing the same byte every time. Actually, maybe it'll execute once and then throw an ArrayIndexOutOfBoundsException. That's basic java looping, and you're going to need a firm grip on that before you try to do anything as advanced as PDF reading. the case.oops you are absolutely right that was a silly mistake to forget that,
    Second, what do the docs for getPageContent say? Do they say that it simply gives you the text on the page as if the thing were a simple text doc? I'd be surprised if that's the case.getPageContent return array of bytes so the question will be:
    how to get text from this array? i was thinking of :
        private void jButton1_actionPerformed(ActionEvent e) {
            PdfReader read;
            StringBuffer buff=new StringBuffer();
            try {
                read = new PdfReader("d:/getjobid2727.pdf");
                read.getMetaData();
                byte[] data=read.getPageContent(1);
                int i=0;
                while(i>-1){ 
                    buff.append(data);
    i++;
    String str=buff.toString();
    FileOutputStream fos = new FileOutputStream("D:/test.txt");
    Writer out = new OutputStreamWriter(fos, "UTF8");
    out.write(str);
    out.close();
    read.close();
    } catch (Exception f) {
    f.printStackTrace();
    "D:/test.txt"  hasn't been created!! when i ran the program,
    is my steps right?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to retrieve IndividualStrings from a txt file using String Tokenizer.

    hello can any one help me to retrieve the individual strings from a txt file using string tokenizer or some thing like that.
    the data in my txt file looks like this way.
    Data1;
    abc; cder; efu; frg;
    abc1; cder2; efu3; frg4;
    Data2
    sdfabc; sdfcder; hvhefu; fgfrg;
    uhfhabc; gffjcder; yugefu; hhfufrg;
    Data3
    val1; val2; val3; val4; val5; val6;
    val1; val2; val3; val4; val5; val6;
    val1; val2; val3; val4; val5; val6;
    val1; val2; val3; val4; val5; val6;
    i need to read the data as an individual strings and i need to pass those values to diffarent labels,the dat in Data3 i have to read those values and add to an table datamodel as 6 columns and rows depends on the data.
    i try to retrieve data using buffered reader and inputstream reader,but only the way i am retrieving data as an big string of entire line ,i tried with stringtokenizer but some how i was failed to retrive the data in a way i want,any help would be appreciated.
    Regards,

    Hmmm... looks like the file format isn't even very consistent... why the semicolon after Data1 but not after Data2 or Data3??
    Your algorithm is reading character-by-character, and most of the time it's easier to let a StringTokenizer or StreamTokenizer do the work of lexical analysis and let you focus on the parsing.
    I am also going to assume your format is very rigid. E.g. section Data1 will ALWAYS come before section Data2, which will come before section Data3, etc... and you might even make the assumption there can never be a Data4, 5, 6, etc... (this is why its nice to have some exact specification, like a grammar, so you know exactly what is and is not allowed.) I will also assume that the section names will always be the same, namely "DataX" where X is a decimal digit.
    I tend to like to use StreamTokenizer for this sort of thing, but the additional power and flexibility it gives comes at the price of a steeper learning curve (and it's a little buggy too). So I will ignore this class and focus on StringTokenizer.
    I would suggest something like this general framework:
    //make a BufferedReader up here...
    do
      String line = myBufferedReader.readLine();
      if (line!=null && line.trim().length()>0)
        line = line.trim();
        //do some processing on the line
    while (line!=null);So what processing to do inside the if statement?
    Well, you can recognize the DataX lines easily enough - just do something like a line.startsWith("Data") and check that the last char is a digit... you can even ignore the digit if you know the sections come in a certain order (simplifying assumptions can simplify the code).
    Once you figure out which section you're in, you can parse the succeeding lines appropriately. You might instantiate a StringTokenizer, i.e. StringTokenizer strtok = new StringTokenizer(line, ";, "); and then read out the tokens into some Collection, based on the section #. E.g.
    strtok = new StringTokenizer(line, ";, ");
    if (sectionNo==0)
      //read the tokens into the Labels1 collection
    else if (sectionNo==1)
      //read the tokens into the Labels2 collection
    else //sectionNo must be 2
      //create a new line in your table model and populate it with the token values...
    }I don't think the delimiters are necessary if you are using end-of-line's as delimiters (which is implicit in the fact that you are reading the text out line-by-line). So the original file format you listed looks fine (except you might want to get rid of that rogue semicolon).
    Good luck.

  • Populate a table reading the data from a TXT file

    how can I populate a table reading the data from a TXT file?
    thanks

    Hey Kevin!
    Using FORMS.TEXT_IO to bulk load data from a file strikes me as re-inventing the wheel. It is just about justifiable in a self-service environment, but I regard the EXTERNAL TABLE is a better solution for that situation as well.
    The same applies to UTL_FILE. I think the ability to read text with UTL_FILE is primarily intended for read file-based configuration or file manipulation/processing rather than data loading.
    Re-writing a text file into SQL statements is too much like hard work (even with an editor that supports macro definition and regular expressions) for no real benefit. You lose all the bulk load peformance you would get from SQL*Loader. But for QAD I'd probably let you off with it.
    You missed out one obvious alternative: using Java to turn the contents of an XML file into a CLOB and inserting it into a table which is read by a PL/SQL procedure that parses the XML records and insert the retrieved data into a table.
    Stay lucky, APC

  • Reading integers from a .txt file and computing means

    I have a program that uses for loops to produce ten integers (1-10) are returns the average mean, geometric mean, and harmonic mean.
    Now i need to change this program to read integers from a .txt file and return the same data. Basically i need to change my for statements that are incrementing to read the text file.
    Thanks guys.

    You haven't asked a question. You haven't posted code. What are you expecting here?
    But I guess I'll take a stab at it and say you should look at the Scanner class
    http://java.sun.com/javase/6/docs/api/java/util/Scanner.html
    or BufferedReader
    http://java.sun.com/javase/6/docs/api/java/io/BufferedReader.html
    I'll never understand what makes people come to the forums, create an account, and ask a lazy question, when they could get a great answer much quicker through Google.
    http://www.google.com/search?q=java+file+input (hint: look at the second search result)

  • Read numbers from a .txt file and display them in a graph

    How can I get Labview 7 to read from a txt. file containing a lot of
    coloumns with different datas? There`s only two of the coloumns that are
    interesting to me, the first, that contains the time of the measuring, and
    one in the middle, that contains the measured temperatures. I want Labview
    to read this datas and display them graphicly.
    Thanks from Stale

    Here's one way.
    You can also use the help-> find examples and search for "text".
    2006 Ultimate LabVIEW G-eek.
    Attachments:
    Graph.vi ‏21 KB

  • Pulling text from a .txt to a scroll pane or text area

    Hi-
    I'm sure there's a way to do this, but I'm not exactly fluent in ActionScript.
    Basically, my whole website's going to be in Flash, but I want to be able to update one page (sort of a news/blog page) without having to edit the Flash file every time. I'm assuming the easiest way to do this would be to set up either a scroll pane or a text box and pull the text in from a .txt file (if there's a better way, please let me know). That way I could continue to add on to the .txt file, and Flash would always pull in the current version.
    So, my issues are:
    1. I have no idea where to start with the code for something like that. Is it a LoadVar? Do I physically put a scroll pane or a text area in the frame and put the action on that, or do I put the action on the frame and have it call up a text area component?
    2. Will the text scroll automatically, or is that something else I would have to add in? I plan on adding to this text file for awhile, so it could end up being a lot of text over time.
    3. Would I be able to format the text in the .txt at all? For instance, if I hit enter to put in a paragraph break, would that register once it's pulled into Flash, or would I have to put in an html paragraph break or something? That may be a dumb question, but as I said, I'm not exactly fluent in ActionScript (or any other programming language for that matter).
    Any help is definitely appreciated!
    Thanks!
    -Geoff

    I recommend you use an xml file rather than a text file for storing your content.  The main reason being that it tends to make thing more easily organizable, as well as easier to differentiate things like titles, contents, links, images, etc.
    You could start off using a TextArea component if you want, just to keep things simple.  If you want to format things you can use the htmlText property rather than the text proiperty when assigning your content.  That will allow you more control of the presentation.
    If you want to take the xml approach, you should search Google for "AS# XML tutorial" where you substitute whatever version you plan to use for the "#".  If you plan to use AS3, there is a good tutorial here: http://www.gotoandlearn.com/play?id=64

  • Reading Last line(record) from a txt file ina java

    Hi,
    I want to retrive the last line from a txt file.Can anybody help me??
    Thanx in advance

    In order to read the last line you must read all the lines before it. To read lines you can use the BufferedReader and LineNumberReader classes.
    Here's an example of how to read lines of text from a file:
    http://javaalmanac.com/egs/java.io/ReadLinesFromFile.html

Maybe you are looking for

  • DirectLink from Premier Pro CC 2014 to Encore - no longer there

    Trying to get a Premier Pro CC 2014 sequence into Encore CS6 - and it won't happen. The DirectLink from Premier Pro CC 2014 to Encore - is no longer there and I've tried simply dragging the required sequences over from the PP CC window into the timel

  • Problem in relativeURL using forward tag

    Hi,      I have two folders namely first and second, which is under root of Tomcat Apache 4.0 (i.e webapps). In first folder I have one.jsp and second folder two.jsp. One.jsp <jsp:forward page=�/second/two.jsp� /> tow.jsp <% out.println(�Second folde

  • Problems With Accessing Classes

    I am having trouble calling classes that I have written. I put all of my .java files into my bin directory, and then I compile all of them. But when I compile one that has a reference to another class file that I have written, it acts like it doesn't

  • Setting Default Printer via GPP

    We have several PC Labs for our Students, and normally we have 2 printers per lab.  We would like to have half of the lab printing to one printer and the other half of the lab printing to the other printer.  I have been successful in deploying the co

  • Best way to move securities from one Active Directory (AD) to another ?

    Hi experts, We are currently moving all our employees from several Active Directories (AD) to a Global active directory (GAD). So user accounts and all our BPC securities set up will keep being the same. Only the active directory has to be changed. W