Global web icon
stackexchange.com
https://unix.stackexchange.com/questions/184863/wh…
What is the meaning of IFS=$'\\n' in bash scripting?
At the beginning of a bash shell script is the following line: IFS=$'\\n' What is the meaning behind this collection of symbols?
Global web icon
stackexchange.com
https://unix.stackexchange.com/questions/16192/wha…
What is the "IFS" variable? - Unix & Linux Stack Exchange
I was reading this Q&A: How to loop over the lines of a file? What is the IFS variable? And what is its usage in the context of for-loops?
Global web icon
stackexchange.com
https://unix.stackexchange.com/questions/26784/und…
shell - Understanding IFS - Unix & Linux Stack Exchange
The following few threads on this site and StackOverflow were helpful for understanding how IFS works: What is IFS in context of for looping? How to loop over the lines of a file Bash, read line by...
Global web icon
stackexchange.com
https://unix.stackexchange.com/questions/209123/un…
Understanding "IFS= read -r line" - Unix & Linux Stack Exchange
Using IFS= LC_ALL=C read -r line works around it there. Using var=value cmd syntax makes sure IFS / LC_ALL are only set differently for the duration of that cmd command. History note The read builtin was introduced by the Bourne shell and was already to read words, not lines. There are a few important differences with modern POSIX shells.
Global web icon
stackexchange.com
https://unix.stackexchange.com/questions/120575/un…
understanding the default value of IFS - Unix & Linux Stack Exchange
Here if the expansion contains any IFS characters, then it split into different 'words' before the command is processed. Effectively this means that these characters split the substituted text into different arguments (including the name of the command if the variable is specified first).
Global web icon
stackexchange.com
https://unix.stackexchange.com/questions/604765/ch…
changing IFS temporarily before a for loop [duplicate]
changing IFS temporarily before a for loop [duplicate] Ask Question Asked 5 years, 3 months ago Modified 4 years, 8 months ago
Global web icon
stackexchange.com
https://unix.stackexchange.com/questions/640062/ho…
How to temporarily save and restore the IFS variable properly?
How do I correctly run a few commands with an altered value of the IFS variable (to change the way field splitting works and how "$*" is handled), and then restore the original value of I...
Global web icon
stackexchange.com
https://unix.stackexchange.com/questions/657656/fo…
For loop over lines -- how to set IFS only for one `for` statement?
Here is an example of behavior I want to achieve: Suppose I have a list of lines, each line containing space separated values: lines='John Smith James Johnson' And I want to loop over lines echoin...
Global web icon
stackexchange.com
https://unix.stackexchange.com/questions/410710/sp…
splitting a line into array in bash with tab as delimiter
If you have empty columns, cut -d$'\t' and IFS=$'\t' have different behaviour with regard to them. Cut will treat each individual tab as a distinct separator, while read will take consecutive tabs as just a single separator. That is, the string foo<tab><tab>bar will be read as just two columns by read, but three columns by cut.
Global web icon
stackexchange.com
https://unix.stackexchange.com/questions/18886/why…
Why is `while IFS= read` used so often, instead of `IFS=; while read..`?
The IFS= read -r line sets the environment variable IFS (to an empty value) specifically for the execution of read. This is an instance of the general simple command syntax: a (possibly empty) sequence of variable assignments followed by a command name and its arguments (also, you can throw in redirections at any point).