Hi All,
I haven't played with Perl/CGI in a while and I'm finding I am a little rusty.
I have a data file that looks like this:
CORP,101,90210-sf101,aggregate2.402:1,10.1.1.100/27,402
BUS1,102,90210-sf102,aggregate3.402:1,10.1.2.100/27,403
BUS2,103,90210-sf103,aggregate4.402:1,10.1.3.100/27,404
BUS3,104,90210-sf104,aggregate5.402:1,10.1.4.100/27,405
BUS1,102,90210-sf102,aggregate3.402:1,10.1.2.101/27,403
BUS3,104,90210-sf104,aggregate5.402:1,10.1.4.105/27,405
I want to:
a. Load this into an array
b. Drop duplicates
c. Key off of the first field
d. Display all line contents common to the unique first field into a table.
Something that looks like this:
CORP
----
101 | 90210-sf101 | aggregate2.402:1 | 10.1.1.100/27 | 402
BUS1
----
102 | 90210-sf102 | aggregate3.402:1 | 10.1.2.100/27 | 403
102 | 90210-sf102 | aggregate3.402:1 | 10.1.2.101/27 | 403
BUS2
----
103 | 90210-sf103 | aggregate4.402:1 | 10.1.3.100/27 | 404
BUS3
----
104 | 90210-sf104 | aggregate5.402:1 | 10.1.4.100/27 | 405
104 | 90210-sf104 | aggregate5.402:1 | 10.1.4.105/27 | 405
I am loading the data table from a file into an array currently, and assigning values using a 'foreach' loop. but now I need to grab the first field and print each variable in the line that the same first field. Make sense?
Any help is appreciated.
I haven't played with Perl/CGI in a while and I'm finding I am a little rusty.
I have a data file that looks like this:
CORP,101,90210-sf101,aggregate2.402:1,10.1.1.100/27,402
BUS1,102,90210-sf102,aggregate3.402:1,10.1.2.100/27,403
BUS2,103,90210-sf103,aggregate4.402:1,10.1.3.100/27,404
BUS3,104,90210-sf104,aggregate5.402:1,10.1.4.100/27,405
BUS1,102,90210-sf102,aggregate3.402:1,10.1.2.101/27,403
BUS3,104,90210-sf104,aggregate5.402:1,10.1.4.105/27,405
I want to:
a. Load this into an array
b. Drop duplicates
c. Key off of the first field
d. Display all line contents common to the unique first field into a table.
Something that looks like this:
CORP
----
101 | 90210-sf101 | aggregate2.402:1 | 10.1.1.100/27 | 402
BUS1
----
102 | 90210-sf102 | aggregate3.402:1 | 10.1.2.100/27 | 403
102 | 90210-sf102 | aggregate3.402:1 | 10.1.2.101/27 | 403
BUS2
----
103 | 90210-sf103 | aggregate4.402:1 | 10.1.3.100/27 | 404
BUS3
----
104 | 90210-sf104 | aggregate5.402:1 | 10.1.4.100/27 | 405
104 | 90210-sf104 | aggregate5.402:1 | 10.1.4.105/27 | 405
I am loading the data table from a file into an array currently, and assigning values using a 'foreach' loop. but now I need to grab the first field and print each variable in the line that the same first field. Make sense?
Any help is appreciated.