Skip to content

Commit

Permalink
use OS-agnostic options for split(1)
Browse files Browse the repository at this point in the history
  • Loading branch information
tastapod committed Jan 12, 2024
1 parent b9e2c2c commit 6269e7f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion snitcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ local now="$(date -Iseconds -u) UTC"
curl --silent "$URL" \
| awk '$1 == "0.0.0.0" && $2 != "0.0.0.0" {printf " \"%s\",\n", $2}' \
| sort > "$working_file"
split -d --number l/2 "$working_file" part-
local chunk_size=$(( ($(wc -l < "$working_file") + 1) / 2))
split -d -l $chunk_size "$working_file" part-
rm "$working_file"

for part in part-*; do
Expand Down

0 comments on commit 6269e7f

Please sign in to comment.