Skip to content

Commit fe9492c

Browse files
authored
Merge pull request #707 from jasonrandrews/review
new script to find oldest 25% of content for review
2 parents 82042a4 + 84b253e commit fe9492c

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tools/find-oldest-quarter.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
# Define the file names
4+
infile="outdated_files.csv"
5+
outfile="oldest-quarter.csv"
6+
7+
if [ ! -f "$infile" ]; then
8+
echo "Missing input file: $infile"
9+
echo "Run 'python3 tools/maintenance.py -r 1' first to generate $infile"
10+
exit 1
11+
fi
12+
13+
# Get the total number of lines in the file
14+
total_lines=$(wc -l < $infile)
15+
16+
# Calculate the number of lines to be selected
17+
lines_to_select=$((total_lines / 4))
18+
19+
# Sort the file by date and select the oldest lines
20+
oldest_lines=$(sort -t, -k2 -n -r $infile| head -n $lines_to_select)
21+
22+
# Print the oldest lines
23+
echo "$oldest_lines" > $outfile
24+
25+
old_count=$(wc -l < $outfile)
26+
27+
echo "There are $old_count items to review in $outfile"
28+

0 commit comments

Comments
 (0)