Find the answer to your Linux question:
Results 1 to 3 of 3
Dear all! I have to join two tables as below. The join has to be based on a identifying field (NAME). One table has the identifyer as row header the ...
  1. #1
    Just Joined!
    Join Date
    Oct 2007
    Posts
    1

    Table Join with bash?

    Dear all!
    I have to join two tables as below. The join has to be based on a identifying field (NAME). One table has the identifyer as row header the other as column header. The result should be a list of tables separated by another field (DATE). For me that seems complicated but possible with bash. Any suggestions?

    Thanks!

    Fred


    Example:

    ------------------------------------------------------------------------
    Sourcefile 1: Identifyer "NAME" as row head with coordinates in columns 2 and 3 separated by <tab>

    NAME X_COOR Y_COOR
    A_Town 30,5 6,89
    B_Town 28,64 5,78
    C_Town 35,1 4,61


    Sourcefile 2: Identifyer "NAME" as column head with Values (e.g. residents) for signle dates (YYYY;MM;DD) separated by <;>

    YYYY;MM;DD;A_Town;B_Town;C_Town
    1903;02;01;5684;20010;50503
    1903;02;02;5680;20010;50504
    1903;02;03;5670;20012;50509

    ------------------------------------------------------------------------


    Targetfiles: Join of Sourcefile 1 Sourcefile 2 based on Identifyer "NAME" for each date separated by <tab>.

    Targetfile 1: Filename: 19030201 (DATE)
    NAME X_COOR Y_COOR VALUE
    A_Town 30,5 6,89 5684
    B_Town 28,64 5,78 20010
    C_Town 35,1 4,61 50503


    Targetfile 2: Filename: 19030202 (DATE)
    NAME X_COOR Y_COOR VALUE
    A_Town 30,5 6,89 5680
    B_Town 28,64 5,78 20010
    C_Town 35,1 4,61 50504


    Targetfile 3: Filename: 19030203 (DATE)
    NAME X_COOR Y_COOR VALUE
    A_Town 30,5 6,89 5670
    B_Town 28,64 5,78 20012
    C_Town 35,1 4,61 50509

    ------------------------------------------------------------------------

  2. #2
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    When does your instructor say this is due?

  3. #3
    Just Joined!
    Join Date
    May 2007
    Location
    seattle
    Posts
    16
    Why BASH? Wouldn't Perl be ideal for something like this?

    --Ray

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...