Perl Script that will read an input file and create two new files based on the data from the first file

This project was successfully completed by agaved for $25 USD in 3 days.

Get free quotes for a project like this
Project Budget
$10 - $30 USD
Completed In
3 days
Total Bids
Project Description

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 [url removed, login to view] [url removed, login to view] [url removed, login to view] [url removed, login to view]

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 [url removed, login to view]

If line contains an "TIMESTAMP:SomeData PT:"

Then Write line to [url removed, login to view]

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.

Completed by:
Skills Required

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online