1
0
Fork 0
mirror of synced 2024-06-02 18:34:37 +12:00
bulk-downloader-for-reddit/scripts/extract_failed_ids.sh
2021-05-23 12:25:04 +10:00

23 lines
576 B
Bash
Executable file

#!/bin/bash
if [ -e "$1" ]; then
file="$1"
else
echo 'CANNOT FIND LOG FILE'
exit 1
fi
if [ -n "$2" ]; then
output="$2"
echo "Outputting IDs to $output"
else
output="failed.txt"
fi
{
grep 'Could not download submission' "$file" | awk '{ print $12 }' | rev | cut -c 2- | rev ;
grep 'Failed to download resource' "$file" | awk '{ print $15 }' ;
grep 'failed to download submission' "$file" | awk '{ print $14 }' | rev | cut -c 2- | rev ;
grep 'Failed to write file' "$file" | awk '{ print $16 }' | rev | cut -c 2- | rev ;
} >>"$output"