Find the answer to your Linux question:
Results 1 to 4 of 4
Dear All, I am new beginner to perl and I need urgent help to make script that can do work on a large text file and generate 65k x 65K ...
  1. #1
    Just Joined!
    Join Date
    Feb 2009
    Posts
    3

    Exclamation Perl script help urgent!

    Dear All,

    I am new beginner to perl and I need urgent help to make script that can do work on a large text file and generate 65k x 65K matrix as follow.

    1. the input is test file as:

    5 2 1
    5 4 1
    5 6 4 1
    5 2 4 1
    5 3 2 1
    5 6 7 3 2 1

    the script should read each line & then scan the values of each line (separated by space value) the generate [7 x 7] matrix with all are zero elements except:
    a (i, j +1) =1;
    where : i = row index
    j = element index with row i.

    this will be excuted as:
    (5,2) = 1
    (2,1) = 1
    (5,4) = 1
    (5,6) = 1
    (6,4) = 1
    (4,1) = 1
    and so on .
    .

    so the final output will be a text file with:

    0 0 0 0 0 0 0
    1 0 0 1 0 0 0
    0 1 0 0 0 0 0
    1 0 0 0 0 0 0
    0 1 1 1 0 1 0
    0 0 0 1 0 0 1
    0 0 1 0 0 0 0

  2. #2
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    This sounds a lot like a homework question, which are not allowed on this forum.

    If this is not a homework question, what are you having difficulty with? What code have you already written? How are you thinking about solving this?
    DISTRO=Arch
    Registered Linux User #388732

  3. #3
    Just Joined!
    Join Date
    Feb 2009
    Posts
    3
    Dear Cabhan,

    Thanks for stopping by
    first this not homework question, actually I am working in analysis BGP table plus building and visualizing network nodes topology.
    I already using Unix scripts & Matlab codes but I thought Perl script will help to organize my input files before process them,

    Right now my problem is how to read line columns (values) in Perl

  4. #4
    Just Joined!
    Join Date
    Feb 2009
    Posts
    3
    Hi all,

    iam still looking 4 help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...