|
6 | 6 | # you have to manually run remove_instructions.sh to remove the files
|
7 | 7 | # this script requires exiftool and feh
|
8 | 8 | # TODO: implement this in the extension
|
| 9 | +# |
| 10 | +# Usage: |
| 11 | +# repo_dir=/path/to/repo |
| 12 | +# cd /path/to/images |
| 13 | +# |
9 | 14 |
|
10 |
| -ls -1 *.txt | while read f; do |
11 |
| - sed 's/, /\n/g' "$f" | sort | tr '\n' ',' | sed "s~,$~\t$f\n~" |
12 |
| -done | sort | awk -F'\t' '{ |
13 |
| - a[$1] = a[$1] == "" ? $2 : a[$1]"\t"$2; |
14 |
| -} END { |
15 |
| - for (i in a) { |
16 |
| - if (index(a[i], "\t") != 0) { |
17 |
| - print a[i]"\t"i; |
18 |
| - } |
19 |
| - } |
20 |
| -}' > ../ff_dedup.txt |
21 |
| - |
22 |
| -while read first_file second_file etc; do |
| 15 | +# use tabs as field separator |
| 16 | +while read -r -d '\t' first_file second_file etc; do |
23 | 17 | # images may be jpg jpeg or png
|
24 | 18 | first_image=$(basename "$first_file" ".txt")
|
25 | 19 | if [[ -f "$first_image.jpg" ]]; then
|
@@ -80,7 +74,15 @@ while read first_file second_file etc; do
|
80 | 74 | echo rm "$first_file" "$first_image"
|
81 | 75 | fi
|
82 | 76 | kill $pid1 $pid2
|
83 |
| -done < <(cat ../ff_dedup.txt) > remove_instructions.sh |
84 |
| - |
85 |
| - |
86 |
| - |
| 77 | +done < <( |
| 78 | +ls -1 *.txt | while read f; do |
| 79 | + sed 's/, /\n/g' "$f" | sort | tr '\n' ',' | sed "s~,$~\t$f\n~" |
| 80 | +done | sort | awk -F'\t' '{ |
| 81 | + a[$1] = a[$1] == "" ? $2 : a[$1]"\t"$2; |
| 82 | +} END { |
| 83 | + for (i in a) { |
| 84 | + if (index(a[i], "\t") != 0) { |
| 85 | + print a[i]; |
| 86 | + } |
| 87 | + } |
| 88 | +}') > remove_instructions.sh |
0 commit comments