update
This commit is contained in:
Executable
+51
@@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check if input file is provided
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Usage: $0 <input_file>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
input_file="$1"
|
||||
|
||||
# Check if file exists
|
||||
if [ ! -f "$input_file" ]; then
|
||||
echo "Error: File '$input_file' not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Process each line of the input file
|
||||
while IFS= read -r line || [ -n "$line" ]; do
|
||||
# Skip empty lines
|
||||
[ -z "$line" ] && continue
|
||||
|
||||
# Extract filepath (everything before first colon)
|
||||
filepath=$(echo "$line" | cut -d: -f1)
|
||||
|
||||
# Extract status (WARNING)
|
||||
status="WARNING"
|
||||
|
||||
# Split based on different patterns
|
||||
if [[ "$line" =~ "WARNING: toctree contains reference to nonexisting document" ]]; then
|
||||
description="toctree contains reference to nonexisting document"
|
||||
data=$(echo "$line" | sed "s|^.*$description ||")
|
||||
elif [[ "$line" =~ "WARNING: undefined label:" ]]; then
|
||||
description="undefined label:"
|
||||
data=$(echo "$line" | sed "s|^.*$description ||")
|
||||
else
|
||||
# For the first line with deprecated substitutions
|
||||
description=$(echo "$line" | sed "s|^.*WARNING: ||" | sed "s| \[.*$||")
|
||||
data=$(echo "$line" | grep -o "\[.*$" | tr -d '[]')
|
||||
fi
|
||||
|
||||
# Replace /, \, and _ with - in data
|
||||
modified_data=$(echo "$data" | tr '/\\_' '-')
|
||||
|
||||
# Print the results
|
||||
echo "filepath = $filepath"
|
||||
echo "status = $status"
|
||||
echo "description = $description"
|
||||
echo "data = $modified_data"
|
||||
echo "-------------------"
|
||||
|
||||
done < "$input_file"
|
||||
Reference in New Issue
Block a user