I found this code snipit listed below that will edit a users file in place. It works great via the command line. I'm trying to pass the arguments to the script named edit.pl and it will not work if called via a system call ie:
system ("perl -pi -e 's/^(username)(\s+.*)(old-pass)(.*)$/${1}${2}new-pass${4}/' users"); I'm looking to adapt this to be able to be called as follows: edit.pl username password newpassword #!/usr/bin/perl # $username=$ARGV[0]; $password=$ARGV[1]; $newpassword=$ARGV[2]; # perl -pi -e 's/^($username)(\s+.*)($password)(.*)$/${1}${2}$newpassword${4}/' users-file.txt And the 2nd application I want to implement is to find a given username and password and if found remove them from the file. delete.pl username password This is what the file looks like.... [EMAIL PROTECTED] Password = "abcdef" [EMAIL PROTECTED] Password = "123" [EMAIL PROTECTED] Password = "secret" ....... Greg Schiedler Can someone help me edit my users file via perl would go thru my users file locate a user with the right username (say "user") replace his password (say "old-pass") with a new password print out the entire user file so i can pipe it to a file perl -pi -e 's/^(username)(\s+.*)(old-pass)(.*)$/${1}${2}new-pass${4}/' users .... will edit the users file in-place -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]