...
Once a line has been read, it can be parsed, for example, using cut, as shown below. Other notes:
- The double quotes around the text that "$line" are important to preserve special characters inside the original line (here tab characters).
- without the double quotes, the line fields would be separated by spaces, and the cut field delimiter would need to be changed.
- Some lines have an empty job name field; we replace job and sample names in this case.
- We assign file descriptor 4 to the file data being read (
4< sampleinfo.txt
after the done keyword), and read from it explicitly (read line <&4 in
the while line). This avoids conflict with any global redirection of standard output (e.g. from automatic logging).
...