The Internal Field Separator is an important concept in shell scripting. It is very useful while manipulating text data. We will now discuss delimiters that separate different data elements from single data stream. An Internal Field Separator is a delimiter for a special purpose. An Internal Field Separator (IFS) is an environment variable that stores delimiting characters. It is the default delimiter string used by a running shell environment.
Consider the case where we need to iterate through words in a string or comma separated values (CSV). In the first case we will use
IFS=" " and in the second,
IFS=",". Let's see how to do it.
Consider the case of CSV data:
data="name,sex,rollno,location" #To read ...