With Bash≥4 you can use mapfile
like so:
while mapfile -t -n 10 ary && ((${#ary[@]})); do
printf '%s\n' "${ary[@]}"
printf -- '--- SNIP ---\n'
done < file
That’s to read 10 lines at a time.
More Related Contents:
- echo “#!” fails — “event not found”
- Pipe output and capture exit status in Bash
- Redirect stderr and stdout in Bash [duplicate]
- Which characters need to be escaped when using Bash?
- How to detect if a script is being sourced
- bash : Illegal number
- Passing arguments with spaces between (bash) script
- How to get script directory in POSIX sh?
- Select random lines from a file
- List files not matching a pattern?
- Variables getting reset after the while read loop that reads from a pipeline
- Sleep until a specific time/date
- Commenting in a Bash script inside a multiline command
- How to delete and replace last line in the terminal using bash?
- Bash script to cd to directory with spaces in pathname
- Unset readonly variable in bash
- Should I use a Shebang with Bash scripts?
- How to use arguments from previous command?
- Split CSV files into smaller files but keeping the headers?
- How to remove last n characters from a string in Bash?
- access host’s ssh tunnel from docker container
- Command to escape a string in bash
- Running several scripts in parallel bash script [duplicate]
- Why would I create an alias which creates a function?
- Check Whether a User Exists
- How to check the extension of a filename in a bash script?
- Indenting heredocs with spaces
- Missing Carriage Return in Docker for Mac Containers
- Reading lines from two files in one while loop
- How do I kill a backgrounded/detached ssh session?