Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I've been tasked with taking some output data from a script and putting it into an html report e-mail for our manager. The first step is to be able to parse from the input file, which will have a format as below: I can do things like remove the date and the lines that say Fault report for x . I'm thinking there must be a way to take in a line to memory and then insert it into an html template in a specific location. I'm just not sure how to do it. The once thing I can't change is the extra line that gets printed after The array is operating normally, that is a function of the reporting tool.

Thu Dec 13 07:03:01 EST 2007 Fault Reports for RDC: Fault Report for SA220: The array is operating normally. Fault Report for SA221: The array is operating normally. Fault Report for SA222: The array is operating normally. Fault Reports for TDC: Fault Report for SA120: The array is operating normally. Fault Report for SA121: The array is operating normally. Fault Report for SA122: The array is operating normally.
I have an HTML template file ready to go. It can be found here:

https://netfiles.uiuc.edu/wruehl/www/EMC.html.tt

I want to be able to pipe in the data from the lines in the text file to the corresponding fields in the html template.

Update: I have some code that is used in a similar manner. If F_INFILE is the input from above, how could I do the search and input like it is done here? I'm not very good with regex stuff, so this looks foreign to me: What is being done here? I know it is going through line by line in the source file, but beyond that I'm not sure, is it searching for a line that contains raidExMibVersion and then piping it to the parameter to be passed?:

open(F_INFILE_3, "< $OUTFILE_3"); open(F_INFILE_8, "< $OUTFILE_8"); $PARAMS{MTIME} = $theTime; foreach (<F_INFILE_3>) { chomp $_; $_ =~ s /^\s//g; $_ =~ s /\./_/g; if ( $_ =~ m/raidExMibVersion/g ) { @TEMP_ARRAY_1 = split("=",$_); @TEMP_ARRAY_2 = split(":",$TEMP_ARRAY_1[1]); $PARAMS{MV} = $TEMP_ARRAY_2[1]; }
-Bill

In reply to Taking information from a text file and inserting it into an html template by wruehl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-03-29 11:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found