How about:
<code>
use strict;

open(IN, "file.txt") || die("AAAARRRGGGHHH!!!! $!");
while(<IN>) # loop through file setting each line to $_
         {
         chomp; # lose newline
         /^([^\s]+)\s/; # look for anything at the beginning of the string 
up to the first space or tab character and remember it
         print "$1\n"; # print the match
         }
close IN;

</code>

At 08:43 18.07.2001 -0500, Tyler Longren wrote:
>Hello everyone,
>
>I have a file that contains a few domain names, and their dns servers (kind
>of like a zonefile).  Here's the format:
>my.com    dns1.blah.com
>me.com    dns1.blah.com
>we.com    dns1.blah.com
>you.com   dns1.blah.com
>
>How can I get ONLY the domain's out of that file, and print each domain to
>the screen.  I used this to search through httpd.conf once:
>open(APACHE_CONF, "/usr/local/apache/conf/httpd.conf") or die "Could not
>open Apache config file:\n$!\n";
>         my @servernames;
>         while(<APACHE_CONF>) {
>                 push (@servernames, $1)
>                 if/ServerName\swww.(.*)/;
>         }
>
>Can anyone help me?
>
>Thanks once again,
>Tyler
>
>
>--
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to