Parse Delimited Data With IFS
Split a simple CSV or TSV line into fields using the IFS separator.
Set IFS=, before read to split each line into comma-separated fields.
01Command
Command
$ while IFS=, read -r name age; do echo "$name is $age"; done < people.csv02What it does
Setting IFS to a delimiter makes read assign one field per variable, which handles simple CSV and TSV without an external parser. It is a lightweight approach for scripts that consume machine-generated data.
03Risk
!Warning: IFS parsing does not understand quoted fields containing the delimiter; use csvkit or a real parser for messy CSV.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- bash.1.en.html manual pageEvidence: The bash manual page documents IFS and read.
Last verified: 2026-10-13 · Category: Developer