Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Can I match a range from an array?

by brassmon_k (Sexton)
on Aug 03, 2001 at 01:40 UTC ( #101797=perlquestion: print w/ replies, xml ) Need Help??
brassmon_k has asked for the wisdom of the Perl Monks concerning the following question:

Monks I seek your supgreme knowledge,

Okay this script (It's in development as of yet that's why it so nappy looking right now) What the script (immediately below this paragraph) does is go through a bunch of cellular call records (Immediately below the script) The script does pattern matches on a phone number and in a record block (Record Blocks are separated by Newlines) and prints out the lines I specify. Each record block has different data and a different amount of lines. When I'm finished I'll use strict and warnings and indent my code but now it's in the rough so it doesn't matter.
#!/usr/bin/perl chomp($msisdn = <STDIN>); $/ = ""; # read paragraphs while ($para = <>) { $lastHeading; @lines = split(/\n/, $para); if (@lines == 1) # A Heading { $lastHeading = $lines[0]; next; } if ($lastHeading eq "MSTerminating") { if ($lines[8] =~ m/$msisdn/) { print "MSTerminating\n"; print "\n"; print "$lines[9]\n"; print "$lines[4]\n"; } } elsif ($lastHeading eq "MSORIGINATING") { if ($lines[7] =~ m/$msisdn/) { print "MSORIGINATING\n"; print "\n"; print "$lines[7]\n"; # sixth line } } elsif ($lastHeading eq "TRANSIT") { if ($lines[7] =~ m/$msisdn/) { print "$lines[7]\n"; } } elsif ($lastHeading eq "mSOriginatingSMSinSMSIWMSC") { if ($lines[4] =~ m/$msisdn/) { print "$lines[4]\n"; } } }
Here is the TEXT
I only showed one record block as they are quite lengthy.
MSTerminating Call Identification Number: 10275050 Related Call Number: 10275036 Record Sequence Number: 2205392 Exchange Identity: MAPP01E 0117802 MSC Identification: TON: 1 NPI: 1 MSISDN: "PHONE NUMBER" Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'503E Incoming Route: AORX02I Outgoing Route: BAPL01O Calling Party Number: TON: 4 NPI: 1 MSISDN: "PHONE NUMBER" Called Party Number: TON: 1 NPI: 1 MSISDN: "PHONE NUMBER I LOOK FOR IN + AN MSTERMINATING RECORD BLOCK" IMSI: 310640010070933 IMEI: NULL Mobile Station Roaming Number: TON: 1 NPI: 1 MSISDN: 19207079858 Redirecting Number: NULL Redirection Counter: 0 Original Called Number: NULL Date for Start of Charge: 01/07/18 Time for Start of Charge: 00:14:38 Chargeable Duration: 00:00:00 Traffic Activity Code: *020 TeleService Code: x'11 Bearer Service Code: NULL Internal Cause and Loc: LOCATION: 11 CAUSE: 46 Time from Register Seizure to Start of Charging: 00:00:15 Time for Stop of Charging: 00:14:38 Interruption Time: 00:00:00 Type of Calling Subscriber: 0 Disconnecting Party: 0 Charged Party: 1 Fault Code: NULL eosInfo: x'0 Call Position: 2 Miscellaneous Information: NULL Restart During Call: NULL Restart Between Disc and Output: NULL Origin for Charging: x'1 Cell ID for Last Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'503E Location Number: TON: 1 NPI: 1 MSISDN: 14147089800 Output for Subscriber: NULL Last Partial Output: NULL Partial Output Rec Num: NULL Regional Service Used: NULL Region Dependent Charging Origin: NULL Transparency Indicator: NULL dTMFUsed: NULL Tariff Class: x'A Tariff Switch Indicator: 0 SS Code: NULL ICI Ordered: NULL
What my problem is: In each Record Block as you'll see in the text of the call record I displayed below (None of the data is live data) is 2 lines which say(One towards the top and the other towards the bottom):

Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'something'
Cell ID for Last Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'something'

As you can see the entire line is the same except for the last portion that is my problem. I was given a list with 387 names of cell sites that correspond to the CI: x'something' portion where something is a number which translates to a name on the list I was given. Now the problem is if I want to get the results I have to do this:
$cell = "Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'272 +6'"; if (m/$cell/) { print Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'APPL20 +';
or I could just do a pat match with the if statement using the string instead of using a scalar

The issue is that I would have to do an "if" and a "print" statement for each of the lines I wish to match so the correct name can be printed out for the appropriate record block and phone number. That would be (744) lines of code just for the "Cell ID for First" and an additional (744) lines for "Cell ID for Last" a total of (1548) lines of code per record block and I will be searching through 4 or more record blocks which is a total of (6192) lines of code. Needless to say I don't even want to think about that. I want to shorten this (Not to mention this way is inefficient).

Here's how I'm pattern matching:
$1 = "Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'271B'" +; %Firstcell = ( Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'2726', Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'271B', Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'3001'); @First = %Firstcell; ($a, $b, $c) = @First; if (lines[05] == m/$b/) { print "$1"; }
See I can get it to match but here's the problem. I have 387 of those lines so I'd have to do:

if (lines05 == m/$b/ || m/$c/ || m/until 387/) {or course in order} Isn't there something where I can say:
if (lines05 == m/$a/ - m/$z/) So I can see if there is a match for the entire group instead of doing the logical OR for each scalar which correlates to a pattern?

One thing I don't think I can get around (Pretty sure) is writing out the $1 = "print this" because each is specific and the PERL can't guess the right answer. I have to tell it what it is.
So my only problem summed up is:
If I put all 387 lines in the %Firstcell hash then make @First = %Firstcell and finally $a, $b, etc until I have all 387 scalars in the @First, is there a way I can run all 387 lines through a pattern match (like a range) all at once instead of typing "||" for each separate match?
The Brassmon_k,
May the Schwartz be with you.

Comment on Can I match a range from an array?
Select or Download Code
Re: Can I match a range from an array?
by rchiav (Deacon) on Aug 03, 2001 at 02:44 UTC
    First,
    <rant>
    warnings and strict are for catching problems at this very stage of development The very first thing you should type in any perl program is..
    #!/usr/bin/perl -w use strict;
    If you were going to add or remove strict or warnings, that would be after the code was frozen.
    </rant>

    OK.. your issue: I think you're trapped by the notion that you have to use a regex to match that number. You don't. You do need one to capture it though. Why not just capture it to $1 or $2 or whatever it happenes to be in the pattern match and then use what was designed for this very thing... a hash. Store all of your cell site codes as the key and whatever is associated with that as the value. Then just do a ..

    if $cellsites{$1} { print "Cell site is: $cellsites{$1}\n"; } else { print "No cell site information for $1\n" }
    Or whatever you want to do with $1.

    Hope this helps..
    Rich

      You are right about warnings and strict I'm just frustrated trying to get this to work and I sort of developed a code writer's block from this. I'm not a 100% sure on what your saying? Are you suggesting this as I showed.
      $1 = "Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'MAD +023"; #This is what I want to print. %Firstcell = ( "Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'4F07", " +Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'MAD023", Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'270B", "C +ell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'APPL2B");
      Now you say I don't need to grab the line with a regex match and you then say I need one to capture it? I'm kinda unclear there. See I don't know what the numbers on the end will be so I can't use grep to capture it.

      So you're saying like this -
      if ($lastheading = "MSTerminating") { if (grep "$1", @lines) { print "$_"; } }
      I only have one problem. For some damn reason "$_" won't print anything. I have:
      while ($para = <>) {
      but that should still print "$_"

      Anyway is what you were talking about something like the above cuz I don't get what you're saying.

      The Brassmon_k
        Well that's not quite what I was referring to.

        Here's what I understand:
        -You have a line that has a number at the end of it that signifies something.
        -You want to print something depending on the number.
        -I'm assuming that what you want to print is the name of the cell site.

        Soooo.. What I would do is the following..

        #!/usr/bin/perl -w use strict; #putting the line in question into $_ for this example. $_ = "Cell ID for Last Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'503E +"; #create our hash of 'site codes' => 'text to print' my %cells = ('207B' => 'Miami', '432F' => 'Buffalo', '443R' => 'Whatever you want for cell site 443R', '503E' => 'Portland, OR' ); if (/CI: x'(\w+)$/) { print "Cell site is $cells{$1}.\n"; }
        Now.. if the regex confuses you, I'd suggest spending a little time with perlre. What this basically does it grabs the last part of the string that you said is variable. Then it takes that and looks it up in the hash. Now this is a very simple example, without error checking and the other various things that you should have in there. You need to take into account if there's no entry in the hash... and how you deal with that.

        Hope this helps..
        Rich

        OK that is so cool that you helped me. I finally got it but yet I don't. My brain block went away and I figured it out. Haven't gotten to much sleep lately. Here it is an almost working version that does everything I want. Now what I can't figure out is the fact that for the if statement you know if ( $cellsite{cell} ) and if ( $cellsite{cell1} ) it's A: obviously finding the Cell ID lines because it prints them out but the problem is B: The "if" statements are supposed to match up with the right "Cell ID" line and only print out the value for that key. My problem is that when I put in the phone number to limit the search results and the value for the key is the "Cell ID MAD023" one it still will print the "Cell ID APPL03". See their are 2 "MSTerminating" record blocks in the file it searches through each have 2 different numbers and 2 different "Cell ID lines" the problem is though that it prints both values for one phone number. What am I doing wrong. The output of the script I'll place below the script. I'm not that familiar with voting here cuz I just hit level 2 today and that (++) or (-) radio buttons above our entries (Didn't see that on level one) but I can give you guys like
        ++ points right? If that's the case you guys are getting em. I'm just double checking with you guys. Anyway here's the code.
        #!/usr/bin/perl -w use strict; my $msisdn; my $cell; my %cellsite; my $lastHeading; my $para; my @lines; my $cell1; chomp($msisdn = <STDIN>); $cell = "Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x' +4F07"; $cell1 = "Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x +'APP03"; %cellsite = ("$cell", "Cell ID for First Cell: MCC: 310 MNC: 64 LAC: + x'44D CI: x'MAD023", "$cell1", "Cell ID for First Cell: MCC: 310 M +NC: 64 LAC: x'44D CI: x'APP03"); $/ = ""; # read paragraphs while ($para = <>) { @lines = split(/\n/, $para); if (@lines == 1) # A Heading { $lastHeading = $lines[0]; next; } if ($lastHeading eq "MSTerminating") { if ($lines[8] =~ m/$msisdn/) { if ( $cellsite{$cell} ) { print "$cellsite{$cell}\n"; } if ( $cellsite{$cell1} ) { print "$cellsite{$cell1}\n"; } print "MSTerminating\n"; print "\n"; print "$lines[8]\n"; print "$lines[4]\n"; } } elsif ($lastHeading eq "MSORIGINATING") { if ($lines[7] =~ m/$msisdn/) { print "MSORIGINATING\n"; print "\n"; print "$lines[7]\n"; # sixth line } } elsif ($lastHeading eq "TRANSIT") { if ($lines[7] =~ m/$msisdn/) { print "$lines[7]\n"; } } elsif ($lastHeading eq "mSOriginatingSMSinSMSIWMSC") { if ($lines[4] =~ m/$msisdn/) { print "$lines[4]\n"; } } }
        Command line/Script output.
        $ exp4.53 output #Command line 6082572086 #Command line OUTPUT Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'MAD023 Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'APP03 MSTerminating Calling Party Number: TON: NPI: 1 MSISDN: "phone number" MSC Identification: TON: 1 NPI: 1 MSISDN: "phone number"
        So you can see my problem. For the phone number I looked up in this record block the "Cell ID" line has "4F07" at the end - So the script looks at the hash and prints out the appropriate garbage. However for the "Cell ID" line "503E" isn't there and that when translated to it's name is "APP03" so that shouldn't have printed but it did anyway even though that number isn't in the "Cell ID" line for this particular record block. So it's printing one line of garbage. What's the problem, I can't figure this out.

        The Brassmon_k
Re: Can I match a range from an array?
by wardk (Deacon) on Aug 03, 2001 at 03:06 UTC

    When I'm finished I'll use strict and warnings and indent my code but now it's in the rough so it doesn't matter.

    bzzzzzzzzt....wrong!.....*now* is when strict and warnings should most certainly be used. On not indenting/formatting your code is something I won't get on ya about, you'll be doing that yourself soon enough :-)

Re: Can I match a range from an array?
by Zed_Lopez (Chaplain) on Aug 03, 2001 at 05:41 UTC
    if (lines05 == m/$a/ - m/$z/) So I can see if there is a match for the entire group instead of doing the logical OR for each scalar which correlates to a pattern? @First, is there a way I can run all 387 lines through a pattern match (like a range) all at once instead of typing "||" for each separate match?
    rchiav's already given what I consider the clearly appropriate approach, but I thought I'd add that there are ways to do what you asked.
    my $str = $_; my $matched = scalar grep { $str =~ /$_/ } @regexes;
    $matched has the number of times $_ was matched by a regex in @regexes, thus neatly being true if it matched 1 or more, and false if it didn't match any.
Re: Can I match a range from an array?
by snafu (Chaplain) on Aug 03, 2001 at 21:52 UTC
    Ok. This writeup has particlarly interested me. However, there are a few things that are really 'fusing me.

    Is it me or is this snippet of code broken? I don't see how you can get an accurate answer from if (@lines == 1) {....

    @lines = split(/\n/, $para); if (@lines == 1) # A Heading { $lastHeading = $lines[0]; next; }

    The if-then would always return false and therefore $lastHeading would never get substituted, right? What am I missing?

    Next, I am still not positive what the author wants which is probably just my interpretation of the question. Brassmon_k don't take anything I write here personal. I am just asking for my own clarification. I want to help because I find this topic near and dear to my work =P. I work for a telco and deal with this kind of stuff alllll the time. Never done wireless though.
    I see that you want call information but I think I am missing how you want to extract this information and what you're grabbing this information from. I have a snippet of code I wanted to present but it works more along the lines of sucking a file (record file) in and spitting out all the lines containing the information I believe you want (not done yet, just grabs all lines with Cell right now). It places every line occurrence into an array and then every 2 lines into another array to seperate first and last cell. BUT, it seems this is not what you want in terms of your desired output, so I am a little lost on the question I think. Thank goodness the other monks could get ya. :) I am finding your question to be jumpy and for me it is not entirely understandable. I should clarify that I KNOW you want to actually get the information extracted from the lines containing 'Cell' in them and if I can get further personal clarification on this I can then tweak what I have so far and present it if you'd like.

    ----------
    - Jim

      @lines is being evaluated in a scalar context here and thus returning the number of elements in @lines. For a $para with only one line, it'll be true.
        Ahh yes. Ok. I thought this but I didn't think you could do that without explicitly expressing that the array was being compared as a scalar. I researched it a lil bit more and found out that what I have is failing not because of the if statement but because he is creating the array @lines from his data which will definitely be greater than 1 and this is why it seems to be failing for me. Again, I must be missing something else here. Maybe I just didn't duplicate the situation correctly on my side. If I debug it here is what I get:

        [jconner@kwan ~]$ cat celldata | perl -d code.pl Default die handler restored. Loading DB routines from perl5db.pl version 1.07 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(code.pl:4): chomp(my $msisdn = <STDIN>); DB<1> t Trace = on DB<1> s main::(code.pl:5): $/ = ""; # read paragraphs DB<1> main::(code.pl:6): my $para; DB<1> main::(code.pl:7): my $lastHeading; DB<1> main::(code.pl:9): while ($para = <>) { DB<1> main::(code.pl:11): my @lines = split(/\n/, $para);

        So, here we see that we sucked in the file which is the data he presented in the post.

        DB<1> print $para main::((eval 26)[/usr/local/lib/perl5/5.6.0/perl5db.pl:1510]:2): 2: print $para; Call Identification Number: 10275050 Related Call Number: 10275036 Record Sequence Number: 2205392 Exchange Identity: MAPP01E 0117802 MSC Identification: TON: 1 NPI: 1 MSISDN: "PHONE NUMBER" Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'503E Incoming Route: AORX02I Outgoing Route: BAPL01O Calling Party Number: TON: 4 NPI: 1 MSISDN: "PHONE NUMBER" Called Party Number: TON: 1 NPI: 1 MSISDN: "PHONE NUMBER I LOOK FOR IN + AN MSTERMINATING RECORD BLOCK" IMSI: 310640010070933 IMEI: NULL Mobile Station Roaming Number: TON: 1 NPI: 1 MSISDN: 19207079858 Redirecting Number: NULL Redirection Counter: 0 Original Called Number: NULL Date for Start of Charge: 01/07/18 Time for Start of Charge: 00:14:38 Chargeable Duration: 00:00:00 Traffic Activity Code: *020 TeleService Code: x'11 Bearer Service Code: NULL Internal Cause and Loc: LOCATION: 11 CAUSE: 46 Time from Register Seizure to Start of Charging: 00:00:15 Time for Stop of Charging: 00:14:38 Interruption Time: 00:00:00 Type of Calling Subscriber: 0 Disconnecting Party: 0 Charged Party: 1 Fault Code: NULL eosInfo: x'0 Call Position: 2 Miscellaneous Information: NULL Restart During Call: NULL Restart Between Disc and Output: NULL Origin for Charging: x'1 Cell ID for Last Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'503E Location Number: TON: 1 NPI: 1 MSISDN: 14147089800 Output for Subscriber: NULL Last Partial Output: NULL Partial Output Rec Num: NULL Regional Service Used: NULL Region Dependent Charging Origin: NULL Transparency Indicator: NULL dTMFUsed: NULL Tariff Class: x'A Tariff Switch Indicator: 0 SS Code: NULL ICI Ordered: NULL

        Ok, so now the next thing that will happen is that he splits this information up into an array called @lines.

        DB<2> main::(code.pl:13): if (@lines == 1) { # A heading DB<2> print scalar @lines main::((eval 27)[/usr/local/lib/perl5/5.6.0/perl5db.pl:1510]:2): 2: print scalar @lines; 49

        Which now has 48 elements (49-1) I believe...still that is greater than 1.

        DB<3> main::(code.pl:18): if ($lastHeading eq "MSTerminating") { DB<3> Use of uninitialized value in string eq at code.pl line 18, <> chunk 1 +. Use of uninitialized value in string eq at code.pl line 18, <> chunk 1 +. Use of uninitialized value in string eq at code.pl line 18, <> chunk 1 +. Use of uninitialized value in string eq at code.pl line 18, <> chunk 1 +. main::(code.pl:9): while ($para = <>) { DB<3>

        Which of course fails everytime. Where did I duplicate the situation incorrecty?

        Debugged program terminated. Use q to quit or R to restart, use O inhibit_exit to avoid stopping after program termination, h q, h R or h O to get additional info. DB<3>

        I used the following code (derived from his with my minor tweaks, ie strict and warnings enabled and indentation added:

        #!/usr/bin/perl -w use strict; chomp(my $msisdn = <STDIN>); $/ = ""; # read paragraphs my $para; my $lastHeading; my @lines; while ($para = <>) { @lines = split(/\n/, $para); if (@lines == 1) { # A heading $lastHeading = $lines[0]; next; } if ($lastHeading eq "MSTerminating") { if ($lines[8] =~ m/$msisdn/) { print "MSTerminating\n"; print "\n"; print "$lines[9]\n"; print "$lines[4]\n"; } } elsif ($lastHeading eq "MSORIGINATING") { if ($lines[7] =~ m/$msisdn/) { print "MSORIGINATING\n"; print "\n"; print "$lines[7]\n"; # sixth line } } elsif ($lastHeading eq "TRANSIT") { if ($lines[7] =~ m/$msisdn/) { print "$lines[7]\n"; } } elsif ($lastHeading eq "mSOriginatingSMSinSMSIWMSC") { if ($lines[4] =~ m/$msisdn/) { print "$lines[4]\n"; } } }
        Thanks guys.

        ----------
        - Jim

      Finally, Some telcom intelligence that might have a better grasp on what I'm trying to do.

      OK what I need to do. Boss gave me a list of cell site locations. They're coded to the BASE10. Now I also have a call record that contains the lines "Cell Site Blah Blah"

      Now I have to limit the info returned when I do a search. I search first by record block, MSTerminating, MSORIGINATING, etc.. Then we narrow it down some more saying OK now only if we see the correct number in the appropriate record block. I don't specify a record block just the MSISDN because really in this entire script that is the anchor. Everything else revolves around finding that. The script works. It prints out what lines I tell it under the right record heading for the number that I specify.

      The problematic portion is what I have to do next. OK as I said my bosses list that he gave me has these types of entries in it:

      GRN001A 310-640-1101-10011
      Now if I type "10011" into a BASE converter going from BASE 10 to BASE 16 the number that is popped out is "271B" which is also at the end of some of the "Cell site" lines in the call record file. With the numbers I know what cell site "271B" to call "GRN001A" because "10011" = "271B" which I will find in the call record on line5 for a "MSTerminating" record block see the "271B" or whole line and have it reprint out as - Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'GRN001A - This abbreviation helps us because now we know that the site is in Greenville prior with the 271B we didn't know where it was.

      All this has been accomplished B4 except that I have 387 of these locations to give the script. It's easy to specify one "if you match it then print it" Problem is "If you match any of these cell sites print the right one" That's my problem, I can't tell the script "If you find any of these" or "If you find it print out the correct one"

      Now that I've described my process, you said you're using a call record also. Call Records are fairly standard I know your from a land base so yours are probably different but they are both call records so it should run along the same lines. So maybe that can help me. So post your code if you don't mind. The snippet of code you posted is correct what it does is this:

      Split @lines by new line (So it's reading in paragraphs) Next line @lines == 1
      Thats saying if it's true then $lastHeading = line0 or the first elmement of the array which are the record titles such as "MSTerminating, MSORIGINATING. Then a next; to go on to the rest of the code. It works. Oh I don't know if this would be of interest to you but I have a script that takes call records and can sort through them by date and time (file form is this) TTFILE03.3483010712234522 = .(4random numbers)(6digit date YYMMDD)(6digit time HHMMSS) the script returns the matching call records then searches them for a phone number and spits out the lines I want. I have a built shell menu for it. It's the same thing I'm doing here (Well this is just part of it) I'm modifying the muscle portion of the script, the part that rips out all of the lines I want based off the phone number. Modifying because the original is in AWK and I hate AWK and 2 because I have to do this cellsite translation garbage. It's a fun challenge but I need to grab a smoke. I hope I explained the code snippet good enough. My deficit for writing nodes is my sparatic type of writing. That's what happens with 2 cappacuinos (ENGLISH TOFFEE!)

      The Brassmon_k
        hahahaha...ok. Well, I don't do coffee so maybe my calmness and your coffeeness will bring us up to speed =P. First, yup, you're right. I come from the landline side. Actually, our cdr's are really different from what you've shown me. But that is neither here or there. Lets see if I am grasping your needs.

        You have 3 lists then (files). 1 is a list of cell sites in english. Another is a list of cell sites in base10. And finally you have the CDR.

        The file your boss gave you comes with the "cryptic" information that looks like a location id (GRN001A) with the NPA-NXX and suffix (310-640-1101) and then the base10 of identifier of the cell site (10011). The hex conversion of 10011 is 271B which will now match up with the call record (where MSTerminating shows the record block). Now, you want to convert the instance of

        Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'271B
        to...
        Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'GRN001A

        And you want to be able to do this in a massive conversion...
        Do I have the idea? :) As for my code, it wasn't going in the right direction. I will still post it if ya want...its nothing big. I would like to check out the script you are talking about that does the sorting on cdr's. That might help me in something I might undertake soon. Let me munch on this one you have brought up....permitted I understand now what you need and time permitting. I am at work right now which of course takes precedence.

        ----------
        - Jim

On the importance of proper indentation
by petdance (Parson) on Aug 06, 2001 at 04:21 UTC
    I have no idea what your code does, because there's no indentation, and I don't care to trace the flow of unindented code. I'm guessing that whatever your problem is can be traced back to you and the compiler not agreeing on what the code does. Proper indentation of code is the single most important thing to take a look at when your code doesn't do what you expect it to do.

    If you're going to do any amount of serious programming (i.e. stuff like this), you owe it to yourself to buy, read and memorize Code Complete by Steve McConnell. It's a career in paperback.

    xoxo,
    Andy
    --
    <megaphone> Throw down the gun and tiara and come out of the float! </megaphone>

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://101797]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2014-09-20 09:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (157 votes), past polls