Hello,

I have a CSV file like:

01,xyz
02,mux
03,mysite
04,mycarsite
05,etcweb

I would like to write a cood the read this csv file and replace the password of the account as such to have formula that contains the numbers above. For example

01,xyz->mypassword01pad
02,mux->mypassword02pad
03,mysite->mypassword03pad
04,mycarsite->mypassword04pad
05,etcweb->mypassword05pad

I tried my best and came up of the following:

cpwd

Code:
#!/bin/bash
INPUT=$1
FORMULA=$2

OLDIFS=$IFS
IFS=,
[ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; }
while read index acct
do

       pw=`echo $FORMULA|sed "s/##/$index/g"`
       
      # passwd $acct $pw
      # Here I want to change each account with $pw

done < $INPUT

IFS=$OLDIFS
The CSV File
Code:
01,john
02,mike
03,matt
My optimum goall is to type

Code:
cpwd csv_filename formula
TIA