Hi,
I have to extract some information using perl from some files and I assume will deal with pattern matching which I am not very experienced with so am in need of a bit of help. Below is a sample of the format of these files, although of course these files are not totally uniform and can have some irregularities.
<-- Sample File Starts Here (this is not part of the file -->
/**
* file description
**/
/**
* A number of comments like this
**/
create table table_name (
timestamp,
attribute1 char(3) not null, /* Description 1 */
attribute2 float not null, /* Description 2 */
attribute3 float not null,
attribute4 float not null, /* Description 3 */
) on data_seg
<-- Sample ends here -->
What I would like to do is to extract into a 2 by X array the fieldname eg timestamp, attribute1 etc and the description of that fieldname in the comments at the end of the line eg Description 1 (I don't want the comment markers). However, some lines do not have comments so I need the description of these to be left blank.
I hope this is enough info and that someone can help.
Cheers
Rob
I have to extract some information using perl from some files and I assume will deal with pattern matching which I am not very experienced with so am in need of a bit of help. Below is a sample of the format of these files, although of course these files are not totally uniform and can have some irregularities.
<-- Sample File Starts Here (this is not part of the file -->
/**
* file description
**/
/**
* A number of comments like this
**/
create table table_name (
timestamp,
attribute1 char(3) not null, /* Description 1 */
attribute2 float not null, /* Description 2 */
attribute3 float not null,
attribute4 float not null, /* Description 3 */
) on data_seg
<-- Sample ends here -->
What I would like to do is to extract into a 2 by X array the fieldname eg timestamp, attribute1 etc and the description of that fieldname in the comments at the end of the line eg Description 1 (I don't want the comment markers). However, some lines do not have comments so I need the description of these to be left blank.
I hope this is enough info and that someone can help.
Cheers
Rob