Ravi Sir's Cards › AWS
mapfile vs while read
This comparison card contrasts mapfile and while read. mapfile is described as all lines at once. while read: One line at a time. The card pairs mapfile with small files, and while read with huge files.
Read card text
What this card says
Read
mapfile
All lines at once.
while read
One line at a time.
Key points
Fast, simple.
Low memory, can process.
Example
mapfile -t a < f
Use when
Small files.
Huge files.