[Boulder.pm] Perl Help

Robert L. Harris Robert.L.Harris at rdlg.net
Sun Apr 1 04:33:44 PDT 2007



Completely understand.  I've been there.  If I can
be of help feel free to ping me.

Robert


Thus spake Rod Burgess (rodbandkimb at msn.com):

> Robert,
> Thanks for providing this code.
> I continue to learn new Perl tricks all of the time.
> Again thanks.
> Rod
> 
> 
> >From: "Robert L. Harris" <Robert.L.Harris at rdlg.net>
> >Reply-To: boulder-pm at pm.org
> >To: boulder-pm at pm.org
> >Subject: Re: [Boulder.pm] Perl Help
> >Date: Sat, 31 Mar 2007 21:35:40 -0400
> >
> >
> >
> >
> >Being a little verbose.
> >
> >while(<INPUT>) {
> >   chomp;
> >   ($Part, $Number, $Desc)=split(";",$_ine);
> >   if ($Part =~ /(.*)II/) {
> >     $NewPart=$1." II";
> >   } elsif ( $Part =~ /(.*)([CDI])/) {
> >     $NewPart=$1." ".$2;
> >   } else {
> >     $NewPart=$Part;
> >   }
> >   print OUTPUT $NewPart.";".$Number.";".$Desc;
> >}
> >
> >
> >
> >
> >
> >Thus spake Rod Burgess (rodbandkimb at msn.com):
> >
> > > I have the following file with three data fields separated by a "; 
> >semicol"
> > >
> > > 14567345;1;Oil Seal
> > > 4533457C;1;Heat Shield
> > > 56842204;1;Misc Part
> > > 5481206D;1;Gasket
> > > 81003589I;1;Washer
> > > T23546II;1;Shirt
> > >
> > > The 1st Data Field is Part#
> > > The 2nd Data Field is Number of Parts
> > > The 3rd Data Field is Part Description
> > >
> > > The only change that I need to this file is if the 1st data field being 
> >the
> > > part# ends in a "C,D,I, or II"
> > > I would like the file to look like this (having a space between the part
> > > number an its Identifier.
> > > If that possible with Perl? Could someone show me a sample perl program 
> >to
> > > do this?
> > >
> > > 14567345;1;Oil Seal
> > > 4533457 C;1;Heat Shield
> > > 56842204;1;Misc Part
> > > 5481206 D;1;Gasket
> > > 81003589 I;1;Washer
> > > T23546 II;1;Shirt
> > >
> > >
> > > _______________________________________________
> > > Boulder-pm mailing list
> > > Boulder-pm at pm.org
> > > http://mail.pm.org/mailman/listinfo/boulder-pm
> >
> >:wq!
> >---------------------------------------------------------------------------
> >Robert L. Harris                     | GPG Key ID: E344DA3B
> >                                          @ x-hkp://pgp.mit.edu
> >DISCLAIMER:
> >       These are MY OPINIONS             With Dreams To Be A King,
> >        ALONE.  I speak for              First One Should Be A Man
> >        no-one else.                       - Manowar
> >
> 
> 
> ><< signature.asc >>
> 
> 
> 
> 
> >_______________________________________________
> >Boulder-pm mailing list
> >Boulder-pm at pm.org
> >http://mail.pm.org/mailman/listinfo/boulder-pm
> 
> 
> _______________________________________________
> Boulder-pm mailing list
> Boulder-pm at pm.org
> http://mail.pm.org/mailman/listinfo/boulder-pm

:wq!
---------------------------------------------------------------------------
Robert L. Harris                     | GPG Key ID: E344DA3B
                                         @ x-hkp://pgp.mit.edu
DISCLAIMER:
      These are MY OPINIONS             With Dreams To Be A King,
       ALONE.  I speak for              First One Should Be A Man
       no-one else.                       - Manowar

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.pm.org/pipermail/boulder-pm/attachments/20070401/78b8895d/attachment.bin 


More information about the Boulder-pm mailing list