Using perl Syntax Highlighting
- #!/usr/bin/perl
- sub trim($);
- $va="inicio";
- $contacol=1;
- $cuental=0;
- ##$linea0="3373.51.10.8.1.2.1 : OBJECT IDENTIFIER: .iso.org.dod.internet.private.enterprises.3373.51.14.901";
- ##$linea1="3373.51.10.8.1.4.1 : OCTET STRING- (ascii): 29;2;optional board ;PPI 29;5";
- ##$linea2="3373.51.10.8.1.4.1 : OCTET STRING- (ascii):";
- ##$linea3="3373.51.10.8.1.1.1 : INTEGER: 1";
- @c=split(/:+/, $linean);
- @aid=split('\.', $c[0]);
- if ($va eq $aid[5])
- {
- $cambio=0;
- }
- elsif ($va eq "inicio")
- {
- $va=$aid[5];
- $cambio=0;
- }
- else
- {
- $cambio=1;
- $contacol+=1;
- print "\n";
- $va=$aid[5];
- }
- use Switch;
- switch (trim($c[1]))
- {
- case "INTEGER"
- {
- print "$c[0]i ". trim($c[2]). "\n";
- }
- case "OBJECT IDENTIFIER"
- {
- print "$c[0]oi ". trim($c[2]). "\n";
- }
- case "IpAddress"
- {
- print "$c[0]ia ". trim($c[2]). "\n";
- }
- case "OCTET STRING- (ascii)"
- {
- print "$c[0]ocs ". trim($c[2]). "\n";
- }
- case "Timeticks"
- {
- print "$c[0]tm ". trim($c[2]). "\n";
- }
- }
- sub trim($)
- {
- my $string = shift;
- $string =~ s/^\s+//;
- $string =~ s/\s+$//;
- return $string;
- }
Coloreado en 0.004 segundos, usando GeSHi 1.0.8.4
Gracias