While loop, how to read from second line of text file

i've tried everything for the past 2 hours to get this working but my experience in shell and programming is limited.

I have a loop

while IFS="," read var1 var2 var3 var4 var5 ; do

statements here...

done < $file

Now the operation inside statement is to read from a text file that has 5 fields as you can see and then use them to create accounts in Linux using bash

useradd $var1 -p var2 -g var3 and so on

I want to make the script to start reading from the second line only, i cant get it working. something like while ifs=, read (from second line) var 1 var 2 var3 etc.

the reason for this is that the file is an exported database from excel to csv so the first line would contain titles like first name dob enrolled etc etc and is not needed

Your help is appreciated


Before the users are being created, I have added an if statement and if users meet a condition then they will be created.

if [ "$var5" == "fullyenrolled" ]; then
continue with account creation...
echo "$var1 successfuly created"
echo "Sorry user $var1 is not fully enrolled"

the output of the echo is something like

Full name is not fully enrolled
user1 successfuly created
user2 successfuly created

even if i add sed 1d | while IFS= etc etc. it seems that it is still reading the first line this is why im getting the first output like "full name is not fully enrolled"


Use sed to "delete" the first line from the input passed to the while loop

sed 1d $file | while ...
         your statements here

Need Your Help

How restrict textbox in C# to only receive numbers and (dot “.” or comma “,”), after “.” or “,” only allow 2 number characters

c# numbers comma restrict

i am trying develop a code to restrict TextBox using C# to only allow numbers entry + comma(",") or dot(".") + only 2 numbers after dot or comma

How to create a link without creating directory?

php apache .htaccess url

Have you seen some websites which have some links and webpages but no directiry exists!