Hello,
I am beginner with awk and I would like to resolve the following problem :
I have a csv file which content : key,username,password.
I would like to make a shell script in order to load them in my htpasswd file.
Example of the csv file :
Key,username,password
User,John,pass_john
User,Marcia,pass_marcia
NotUser,William,pass_Will
There is one condition, if in the first field there is the word "User" then I would like to update his password in htpasswd otherwise I don't want to update anything
The following code seems not to be working, It is like the command htpasswd is not working.
#!/usr/bin/ksh
awk -F "," '{if ($1=="User"){"/path/apache/bin/htpasswd -mb /path_file/wtpasswd "$2" "$3;}}' file.csv
The command to update a password should respect the following format :
/Path_htpasswd/htpasswd -mb /Path_fileUserPass/wtpasswd username password
If you can help me it would be great.
Thanks,
I am beginner with awk and I would like to resolve the following problem :
I have a csv file which content : key,username,password.
I would like to make a shell script in order to load them in my htpasswd file.
Example of the csv file :
Key,username,password
User,John,pass_john
User,Marcia,pass_marcia
NotUser,William,pass_Will
There is one condition, if in the first field there is the word "User" then I would like to update his password in htpasswd otherwise I don't want to update anything
The following code seems not to be working, It is like the command htpasswd is not working.
#!/usr/bin/ksh
awk -F "," '{if ($1=="User"){"/path/apache/bin/htpasswd -mb /path_file/wtpasswd "$2" "$3;}}' file.csv
The command to update a password should respect the following format :
/Path_htpasswd/htpasswd -mb /Path_fileUserPass/wtpasswd username password
If you can help me it would be great.
Thanks,