read tables from txt files

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wshibl
    New Member
    • Aug 2012
    • 1

    read tables from txt files

    I have a lot of files that have the same below format in different folders and I need to parse these files and add them in one file :

    X1 = 1
    X2 = 2
    X3 Y1 Y2
    0.005 0.047539 0.029597
    0.362143 0.078621 0.0087323

    What I need to do is to write the above data in diferent format like that:
    X1 X2 X3 Y1 Y2
    1 2 0.005 0.047539 0.029597
    1 2 0.005 0.047539 0.029597
    1 2 0.362143 0.078621 0.0087323
    1 2 0.362143 0.078621 0.0087323

    Also some files contain more than 3 Xs and More than 2 Ys
    So what I need is to 1st find these files which have the same name xxx.txt and parse the files by adding the variables in variable names and add the tables in arryes then write them in the format I need
    I am new in PERL so any help will be appreciated
Working...