![Split Split](/uploads/1/2/5/4/125403719/202590416.gif)
Nov 14, 2015 The responses like to use strtokr are additional libraries and not C, so are not the right answer. What the question is asking for is the code to manipulate a string, not what external libraries calls are available to do it instead.
@sorontar unset IFS doesn't restore IFS to the default value, but it returns field splitting to the default effect. Yes, it's a limitation, but usually an acceptable one in practice. The problem with a subshell is that we need to get data out of it. I do show a solution that doesn't change the state at the end, with read. (It works in POSIX shells, but IIRC not in the Bourne shell because it would run the read in a subshell due to the here-document.) Using.