use strict; while (<DATA>) { chomp; if (/CN=\w+/) { $_ =~ s/^(.+?"CN=.+?),.+$/$1"/; print "$_\n"; } } __DATA__ DHCP Administrators,2,"Enterprise Admins,Users,DC=INTERNETNET,DC=com Domain Admins,Users,DC=INTERNETNETCOM,DC=com",, DnsAdmins,2,"Enterprise Admins,Users,DC=INTERNETNET,DC=com Domain Admins,Users,DC=INTERNETCOM,DC=com",, AS400 Query Database,2,"CN=Joe Car,OU=Systems/Operations,OU=MIS,OU=Use +r Accounts,DC=INTERNETNET,DC=com Ricrad Tallar,OU=Systems/Operations,OU=MIS,OU=User Accounts,DC=INTERNE +TNETCOM,DC=com",, Deptpar Access,8,"John Class,OU=Marketing,OU=User Accounts,DC=INTERNET +NET,DC=com Judy Lipa,OU=Marketing,OU=User Accounts,DC=INTERNETNET,DC=com George Grey,OU=Marketing,OU=User Accounts,DC=INTERNETNET,DC=com Artur More,OU=Marketing,OU=User Accounts,DC=INTERNETNET,DC=com Raimun Sirilo,OU=Executive,OU=User Accounts,DC=INTERNETNET,DC=com Amilcar Ove,OU=Marketing,OU=User Accounts,DC=INTERNETNET,DC=com Daniel Santos,OU=Executive,OU=User Accounts,DC=INTERNETNET,DC=com Paula Corte,OU=Executive,OU=User Accounts,DC=INTERNETNET,DC=com" Human_Resources,3,"CN=Katarine Gilly,OU=Executive,OU=User Accounts,DC= +INTERNETNET,DC=com Chris Head,OU=Human Resources,OU=Finance & Administration,OU=User Acco +unts,DC=INTERNETNET,DC=com Susany Cadru,OU=Human Resources,OU=Finance & Administration,OU=User Ac +counts,DC=INTERNETNET,DC=com"

In reply to Re: CSV File Question by nedals
in thread CSV File Question by Anonymous Monk

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.