You have chosen to sponsor your bid up to a maximum amount of .
Need a perl script written that will do the following:
1. Read a text file
2. Based on data in this file write to two new text files.
3. It must allow for variable file names. So I would run the script like... perl scriptname.pl input.log SUBOutput_File1.log PUBOutput_File2.log
4. No data loss from the input file... All data from the input file will go in either of the Output files or Both Files.
5. Spacing and tabs need to remain in place. No loss of formatting.
6. Basically, read a line, write the same exact line to one or both of the output files.
This log file is a trace of some directory based events. It has XML in the events and the spacing and tabs of these xml text must not change.
Each line in the input file will be one of these kinds of lines. On the lines with the TIMESTAMP, anthing after the second ":" is just data.
The TIMESTAMP can be many formats and styles. Sometimes it has a colon in it sometimes it does not.
XML Nodes or attributes.
JUST DATA and not XML nor part of the ST or PT lines
See attached files for example
Read line of input doc
Save in a variable if the line contains a "ST:" or "PT:" or ":"
If line contains a "TIMESTAMP:SomeData ST:"
Then Write line to SUBOutputFile.log
If line contains an "TIMESTAMP:SomeData PT:"
Then Write line to PUBOutputFile.log
If line contains just a ":" (So no ST: or PT:) or if it say "EV:"
Then Write line to both Files
If line contains XML data
Then read the variable (ST: or PT:) and write all the XML data to the appropriate output file.
(So if a line is read that contains then read the variable for PT: or ST: and write the line including formatting to the appropriate output file)
(Each subsequent xml data line must be then written to the same file until a new line is read that has a "PT:" "ST:" or just ":" in it.)
If the line is just data or is a blank line and does not have any ST: PT: single colon, or XML data
Then do same as if XML data. Read variable and write to the appropriate file.
See files attached for samples.
For someone who knows perl really well, this should be a pretty easy script.
Thanks for bidding.