Hi, I'm failling to read the 2nd input file in citrix-enum-apps-xml-PORT-STATE-SERVICE+IP-disk.pl in the while loop line 11
die "perl citrix-enum-apps-xml-PORT-STATE-SERVICE+IP-disk.pl <INPUT_FI +LE_ports> <INPUT_FILE_IP> <OUTPUT_FILE> " if $#ARGV < 2; open(F0, $ARGV[0]); open(F1, $ARGV[1]); open(F2, ">>$ARGV[2]"); $line_no=$line_stop=0; while (<F0>) { s/\r\n//; /^[0-9]+/; $line=$'; $line_no=$&; while (<F1> && $line_stop++ < $line_no) { s/\r\n//; } print F2 $_, "\t$line\n" if /[0-9]+\//; } close F0; close F1; close F2;
I have tried to replace that line 11 with
while (<F1> && $line_stop++ < $line_no) { s/\r\n//;print $_; }
but nothing comes out what's wrong ? Remember I have already one input file openned F0 the idea of the script is to replace the line number (3 and 5 here) in port.txt input file
3 PORT state protocol 3 80/tcp closed http 3 443/tcp closed https 3 8080/tcp open http-proxy 5 80/tcp open http 5 443/tcp filtered https 5 8080/tcp filtered http-proxy
and get the IP corresponding to the nth ($line_stop) (3 and 5 here) IP by 1.0.131.74 and 1.0.138.154
1.0.129.197 1.0.131.49 1.0.131.74 1.0.138.143 1.0.138.154 1.0.139.72
to produce
1.0.131.74 80/tcp closed http 1.0.131.74 443/tcp closed https 1.0.131.74 8080/tcp open http-proxy 1.0.138.154 80/tcp open http 1.0.138.154 443/tcp filtered https 1.0.138.154 8080/tcp filtered http-proxy
any ideas ? thank's

In reply to can't read the 2nd input file by perl_boy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.