Shell script prints more values than I want

This is the script:

OLDIFS=$IFS
IFS=","
while read f1 f2 f3 f4
do
        echo $f4,
done < users_test.csv
IFS=$OLDIFS

And the target file looks like this:

Type,Name,Email,User ID,Signed up,Last seen,Web sessions,Country,City

I need to get only the 4th value (under User ID). But with the script that I have written, I get the 4th value and everything after it.

I followed this tutorial. Any heads up on that one?


Source: bash

Leave a Reply