root
commited on
Commit
•
159bf7e
1
Parent(s):
b848467
Add script
Browse files
shard.sh
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
input_file="diffs_33554432_41943040.jsonl"
|
4 |
+
total_lines=8388608
|
5 |
+
num_shards=16
|
6 |
+
|
7 |
+
lines_per_shard=$((total_lines / num_shards))
|
8 |
+
start_line=1
|
9 |
+
|
10 |
+
for i in $(seq 1 $num_shards); do
|
11 |
+
end_line=$((start_line + lines_per_shard - 1))
|
12 |
+
start_range=$((start_line + 33554432))
|
13 |
+
end_range=$((end_line + 33554432))
|
14 |
+
output_file="diffs_${start_range}_${end_range}.jsonl"
|
15 |
+
sed -n "${start_line},${end_line}p" $input_file > $output_file
|
16 |
+
start_line=$((end_line + 1))
|
17 |
+
done
|
18 |
+
|