How Import file .txt positioned?

julianojajulianoja Member Posts: 4 Contributor I
edited November 2018 in Help
I need to know how can i import a file .txt positioned like this:?

RECORD_N      ID_NumNR_ACCOUNT                  PROG      NOME                             
        1              111052376488756571009            D            ELIDES DELAVECHE NICOLAU         
        2              111053376488785441000            D            CILENE CORTEZ                   
        3              111054376488809141008            D            ELISANGELA D ALVES               
        4              111055376488854051003            D            JOSE MAURICIO P GOM             
        5              111056376488860941007            D            IONE C BRITO                     
        6              111057376488868631006            D            ROMARIO P BARBOSA               
        7              111058376488877841000            D            MARCOS ANTONIO DE SOUZA         
        8              111059376488888601005            D            VAGNER FERREIRA                 
        9              111060376488920671008            D            RAFAEL GORTE P SILVA             

Answers

  • Marco_BoeckMarco_Boeck Administrator, Moderator, Employee, Member, University Professor Posts: 1,993 RM Engineering
    Hi,

    If that's a tab separator: Import as CSV, use tab as separator.

    Regards,
    Marco
  • julianojajulianoja Member Posts: 4 Contributor I
    Hi Marco,

    I tried it, but don´t solve the problem,  this file is a .txt file, and the spaces isn't tab spaces!
  • ighybooighyboo Member Posts: 26 Contributor II
    I would import the file in excel first (as the import txt wizard there has a "fixed width" flag) and save the preprocessed file as xls/csv

    If you want to stay in RM I would play with one of the many operators that allow using RegEx to extract your values from each line.

    Hope this helps :)
    Igor
  • julianojajulianoja Member Posts: 4 Contributor I
    Ighyboo,

    In my case i need to import the files directely in RM, i can´t use excel.
    Have other solutions?
  • ighybooighyboo Member Posts: 26 Contributor II
    You can use the "Generate Extract" operator..


    This should do, but you might have to adjust the Start/Offset based on your original file
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.3.015">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.3.015" expanded="true" name="Process">
        <process expanded="true">
          <operator activated="true" class="read_csv" compatibility="5.3.015" expanded="true" height="60" name="Read CSV" width="90" x="45" y="75">
            <parameter key="csv_file" value="C:\Documents and Settings\menghii1\Desktop\text.txt"/>
            <parameter key="first_row_as_names" value="false"/>
            <list key="annotations">
              <parameter key="0" value="Name"/>
            </list>
            <parameter key="encoding" value="windows-1252"/>
            <list key="data_set_meta_data_information">
              <parameter key="0" value="line.true.polynominal.attribute"/>
            </list>
          </operator>
          <operator activated="true" class="text:generate_extract" compatibility="5.3.002" expanded="true" height="60" name="Generate Extract" width="90" x="179" y="75">
            <parameter key="source_attribute" value="line"/>
            <parameter key="query_type" value="Indexed"/>
            <list key="string_machting_queries"/>
            <list key="regular_expression_queries"/>
            <list key="regular_region_queries"/>
            <list key="xpath_queries"/>
            <list key="namespaces"/>
            <list key="index_queries">
              <parameter key="RECORD_N" value="0.2"/>
              <parameter key="ID_NumNR_ACCOUNT" value="15.21"/>
              <parameter key="PROG" value="49.1"/>
              <parameter key="NOME" value="63.50"/>
            </list>
          </operator>
          <operator activated="true" class="select_attributes" compatibility="5.3.015" expanded="true" height="76" name="Select Attributes" width="90" x="313" y="75">
            <parameter key="attribute_filter_type" value="single"/>
            <parameter key="attribute" value="line"/>
            <parameter key="invert_selection" value="true"/>
          </operator>
          <connect from_op="Read CSV" from_port="output" to_op="Generate Extract" to_port="Example Set"/>
          <connect from_op="Generate Extract" from_port="Example Set" to_op="Select Attributes" to_port="example set input"/>
          <connect from_op="Select Attributes" from_port="example set output" to_port="result 1"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
          <portSpacing port="sink_result 2" spacing="0"/>
        </process>
      </operator>
    </process>
Sign In or Register to comment.