I have a list of users I want to add as users to my server (userlist.txt).
I want to add them using useradd and include their name as a comment
so... every line of the file contains something like this:
vno572,2548,veronica norena,cornerstone group,user,4331,1872,49:46
I want to grab "vno572" + "veronia norena" and add the user like this:
useradd vno572 -c "veronica norena"
I need to iterate through the whole file and add each user in each line.
I have this so far:
cat userlist.txt | while read line do echo $userid userid=’cut -d ‘,’ -f 1 userlist.txt’ echo $name name=’cut -d ‘,‘ -f 3 userlist.txt’ useradd $userid -c “$name” done