How Perl Saved my Day
Previous First Next

Example 2:
Extracting data from hundreds of files

The problem

On-line HPLC analysis of chemical reaction progress generated hundreds of files containing the following data:

Method Name =  p7c1s3      Sample Name =    p7c1s1x1
Sample Type = Unk      Filename = CH010001

Run Number     Date              Time       BCD stream
    1       24/2/1995       14: 12:50         N/A
Date Acquired        Time Acquired
 23/2/1995                15:35:50

 PK   R.tim   Height    Height%   Area    Area% Component
  1   1.12         16     1.32     1649    2.81    UNKNOWN
  2   1.83        400    33.92    15281   26.05    PHENOL
  3   3.24        764    64.76    41723   71.14    PHP
We need to extract sample name, acquisition date and time, and the peak areas of the 2 chemical compounds PHENOL and PHP. The file name extension is always PR1.
We note that:
  1. the sample name is the last term on the first line
  2. acquisition date and time are on the 7th line.
  3. peak area is the 5th entry in the analysis results table

Previous First Next
10.12.1998 Michael Gfeller