Text manipulation help

Hello again,

I have a problem manipulating a large text document and there is no way I could edit this document by hand.

Format is:

Address : XXXX N 37 Ave, Hollywood, FL, 33021
Phone: XXX3190XXX
Player: XXXXXX
Character: Jaramillo 
DOB[mm-dd-yyyy]: June-14-1995
-----
Name: Alexandra
Ticket #: XXXXXXXXXXXXXXXXX
Creation Date: 03-2015
Ref: 299XXXXXX
====================
IP: 73.XXXXXXXX - 73.XXXXXXXX
Submited on: Wednesday 22nd of June 2016 04:31:28 PM



Address : XXXX XXXXXX SE, Washington (city), DC (state), 20032 (zipcode)
Phone: XXX5954XXX
Player: XXXXXX
Character: Hernandez
DOB[mm-dd-yyyy]: April-24-1986
-----
Name: GXX(1) JonXX(2)
Ticket #: XXXXXXXXXXXXXXXXX
Creation Date: 03-2016
Ref: 449XXXXXX
====================
IP: 66.44.XXXX - XXXXX.md.cable.rcn.com
Submited on: Monday 20th of June 2016 05:50:03 PM

And so on...

I want the whole list to be like this (only the values from the specific fields):

Ticket #|Creation Month|Creation Year|Ref|Name|Address|City|State|Zipcode|Phone|Player|DOB|IP

Is it possible. Please note... all fields are different in size.

Thank you.

Please show us the output you are hoping to get from the sample data you provided. The formats shown for some of the fields do not match the heading preceding them and I can't tell if you are trying to copy data given or perform data translation functions as well as text manipulations.

And, please post you output in CODE tags too; not just your input.

What code have you come up with while trying to do this on your own?

Save as example2pipe.pl
Run as perl example2pipe.pl galford.file

#!/usr/bin/perl
use strict;
use warnings;

my %info;
while (<>) {
    if (/^Address/../^Submited/) {
        $info{$1} = $2 if /^(\w+)[^:]*:\s?(.*)$/;
    }
    elsif (%info){
        push my @output, $info{'Ticket'}, (split /-/, $info{'Creation'}),
                @{info{'Ref','Name'}}, (split /,\s?/, $info{'Address'}),
                @{info{'Phone','Player','DOB','IP'}};
        print join ("|", @output), "\n";
        %info = ();
    }
}

Output example:

XXXXXXXXXXXXXXXXX|03|2015|299XXXXXX|Alexandra|XXXX N 37 Ave|Hollywood|FL|33021|XXX3190XXX|XXXXXX|June-14-1995|73.XXXXXXXX - 73.XXXXXXXX
XXXXXXXXXXXXXXXXX|03|2016|449XXXXXX|GXX(1) JonXX(2)|XXXX XXXXXX SE|Washington (city)|DC (state)|20032 (zipcode)|XXX5954XXX|XXXXXX|April-24-1986|66.44.XXXX - XXXXX.md.cable.rcn.com

Not too elegant with awk as the Address and Creation fields are to be filled into several fields...

awk '
NR==1                   {HD="Ticket #|Creation Month|Creation Year|Ref|Name|Address |City|State|Zipcode|Phone|Player|DOB|IP"

                         print HD                               # print it
                         sub ("Month\|Creation Year", "Date", HD)
                         sub ("\|City\|State\|Zipcode", _, HD)
                         gsub ("\|", ",", HD)
                         HDCnt = split(HD, HDArr, ",")          # HDArr n HDCnt needed later for extracting and printing
                         HD    = "," HD ","
                        }

function PRT()          {DL = ""                                # clear delimiter

                         for (i=1; i<=HDCnt; i++)       {printf "%s%s", DL, RES[HDArr]       # print fields in sequence, plus delimiter
                                                         DL=SEP                                 # set delimiter
                                                        }
                         printf "\n"
                         delete RES                             # clear for next record
                        }

NF == 0                 {PRT()                                  # empty line means: print complete record
                        }

HD ~ "," $1 ","         {gsub (",", SEP, $NF)                   # prepare Address field
                         if ($1 ~ "Date") sub ("-","|", $NF)    # prepare Creation field
                         RES[$1] = $NF                          # save it for print
                        }

END                  {PRT()}                                    # print last record
' FS="[[:]" SEP="|" file
Ticket #|Creation Month|Creation Year|Ref|Name|Address |City|State|Zipcode|Phone|Player|DOB|IP
 XXXXXXXXXXXXXXXXX| 03|2015| 299XXXXXX| Alexandra| XXXX N 37 Ave| Hollywood| FL| 33021| XXX3190XXX| XXXXXX| June-14-1995| 73.XXXXXXXX - 73.XXXXXXXX
 XXXXXXXXXXXXXXXXX| 03|2016| 449XXXXXX| GXX(1) JonXX(2)| XXXX XXXXXX SE| Washington (city)| DC (state)| 20032 (zipcode)| XXX5954XXX| XXXXXX| April-24-1986| 66.44.XXXX - XXXXX.md.cable.rcn.com

and, the record separator is expected to be one single empty line.