in reply to Text processing question - strange output

Tried using strict? It's a good habit to aquire.
I think what you're trying to do can be done with this:

use strict; open(NB, "nbt.csv") or die "Error reading nbt.csv: $!\n"; while(<NB>){ chomp; @nbtstat = `nbtstat -a $_`; %_=map{$_,1}map{/^\d+.\d+\.\d+\.\d+/;$&}($_,@nbtstat); print join(',',$_,keys(%_)),"\n"; }
As I understand it, you want:
  1. nbtstat each IP address in the file (hopefully XXX.XXX.XXX.XXX, 15 chars ;)
  2. Make a list of unique IP addresses (found at the beginning of each line returned)
  3. Print the list to STDOUT comma seperated

Or have I got the wrong end of the stick?

Note: this'll print the original IP address twice.

--

Brother Frankus.

¤