-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey all,
I'm trying to pull some machine names out of a CSV file, and I'm using the Pattern Test Program from Learning Perl 4th ed, but I don't think I have the logic right. Here's a sample line from the CSV file:

TAP0SMITHJ | smithj (192.168.1.1),DOMAIN | Professional,"4.0.0.1180, 2008-07-31 12:04:56",I,U

(the data was scrubbed with generic info, but it's the same stuff)

So what I want to capture is the TAP0SMITHJ stuff only. Here's the Pattern Test Program I'm using:

#!/usr/bin/perl

use strict;
use warnings;
use 5.010;

while (<>) {                   # take one input line at a time
    chomp;
    if (/^TAP+\wb\|/xm) {
        print "Matched: |$`<$&>$'|\n";  # the special match vars
    } else {
        print "No match: |$_|\n";
    }
}

I'm basically working on getting the regex, then I'm going to incorporate it into a program to pull out the TAP0SMITHJ stuff and put it in another file.

Thanks,
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAkiXdHQACgkQZWzkfeDiTw5hZgCdFOWLfu6eQAGsXUBSVyqwPa/b
ulQAn2oxs869Eh2I172rTqUjCs88VUyV
=DPep
-----END PGP SIGNATURE-----

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to