How can split data on blocks bash?

perrfect

New Member
Joined
Feb 19, 2020
Messages
2
Reaction score
0
Credits
0
Hi.
I need help with split data on blocks.
I have some lines on my txt-file, about 100.
And I need split lines on blocks to 10 lines each and then print that blocks one by one with delay 3 seconds for each one. How can I do it without create additional files.
The main idea is send blocks line to zabbix server
How can I do it?
 


Code:
#!/bin/bash
let c=1
lines=$(cat txt-file | wc -l)
while [ $c -le $lines ]
do
   awk 'NR>=l && NR<=l+9' l=$c txt-file
   (( c = c + 10 ))
   sleep 3
done
 
Last edited:

Members online


Top