Hi!

Just try

  #!/usr/bin/perl -w

  open DFILE, "<the_domain_file's_name" || die "Can't open that!";
  while (<DFILE>)
  {
     chomp;
     s/([^\s]+)*/$1/;
     print;
  }
  close DFILE;

- this will rip the rest off from each line when the first white space is
encountered.

Sascha

----------
>Von: "Tyler Longren" <[EMAIL PROTECTED]>
>An: "Perl Beginners" <[EMAIL PROTECTED]>
>Betreff: looking at rows in text files
>Datum: Mit, 18. Jul 2001 15:43 Uhr
>

> 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