File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 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+
You can’t perform that action at this time.
0 commit comments