Hi Overkill,

On Wed, 20 Jul 2011 13:24:06 -0400
Overkill <overk...@sadiqs.net> wrote:

> Greetings,
> 
> I'm trying to increment the UID field of the unix password file from an 
> csv file.  I've tried to insert C style increment and it keeps bomping 
> out.  What would be the logic to increment the 5009 to increment by 
> one?  Thanks for any help.
> 
> -Overkill
> 

don't parse CSV using regular expressions - use Text::CSV :

http://perl-begin.org/uses/text-parsing/

Regards,

        Shlomi Fish

> #!/usr/bin/perl
> 
> #use strict;
> #use warnings;
> 
>     while (<DATA>) {
>     chomp;
>      ($first, $last, $username) = split(",");
>        print "$username:x:5009:4001:$first 
> $last:/home/$username:/bin/false\n";
>        }
>    exit;
> 
> __DATA__
> "Bob","Ahrary","bahrary"
> "Jill","Anderson","janderson"
> 
> 



-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
What Makes Software Apps High Quality -  http://shlom.in/sw-quality

The prefix “God Said” has the extraordinary logical property of converting any
statement that follows it into a true one.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to