Hi everyone, and thank you for your help with this. I am VERY new with perl so all of your help is appreciated. I have tried google but as I don't know the proper terms to search for and could be daunting for a newbie scripter... I know this is very easy for most of you! Thanks!
I have a multi-gig file of the repeated format:
<form name="profileForm" action="/profile.php" method="post">
<style type="text/css">
.required {
font-size: small;
color: #f00;
}
</style>
<table border="0" cellpadding="3" cellspacing="1">
<tr>
<td>�</td>
<td class="label">First Name</td>
<td class="label">Last Name</td>
</tr>
<tr valign="top">
<td class="label">Name: <span class="required">*</span></td>
<td class="row"><input type="text" maxlength="20" name="firstName" size="20" value="su" /></td>
<td class="row"><input type="text" maxlength="20" name="lastName" size="20" value="chingping" />
<input type="hidden" name="customerNumber" value="" /></td>
</tr>
<tr valign="top">
<td class="label">Job Title: <span class="required">*</span></td>
<td colspan="2" class="row"><input type="text" maxlength="30" name="jobTitleOther" size="30" value="miss" /></td>
</tr>
<tr valign="top">
<td class="label">Company: <span class="required">*</span></td>
<td colspan="2" class="row"><input type="text" maxlength="30" name="company" size="30" value="omd" /></td>
</tr>
I want to use perl to read in this text file, "out1.txt" and (parse?) it into the values, firstname, last name, job title, company, etc. etc. and output to a csv file
I know that for each of these values, they occur within a specific pattern eg. the "Company" value I want will be always be <td colspan="2" class="row"><input type="text" maxlength="30" name="company" size="30" value="HERE" /></td>. And the other patterns will occur in the same place in similar strings. I know ALL records will exist for each "person"
Is there a good script that is already written that is close OR can someone help me formulate from this to perl :
Open file
Read in each line
While new line exists,
If pattern is (for example) <td class="row"><input type="text" maxlength="20" name="firstName" size="20" value="su" /></td>
output "firstName" to the first csv field, or if pattern
is <td colspan="2" class="row"><input type="text" maxlength="30" name="company" size="30" value="HERE" output value "HERE" to the third csv field,
I am just looking for basic framework for one or two sequential patterns, the while loop, etc.
The problems for me is matching values in a specific location of multiple known strings in sequential order and putting them into a csv file.
Thanks for your help!