Last active
November 24, 2025 03:30
-
-
Save fabiolimace/b572d64f97d9088744d0c3b3658a3050 to your computer and use it in GitHub Desktop.
List Amazon Book IDs of all ebooks in a Calibre Library
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # List all MOBI-ASIN codes extracted from OPF files. | |
| # | |
| # Usage | |
| # | |
| # calibre-list-mobi-asin.sh LIBRARY | |
| # | |
| LIBRARY=${1} | |
| [ -d "$LIBRARY" ] || LIBRARY=$(pwd); | |
| time find "$LIBRARY" -type f -name "*.opf" -exec grep -E '<dc:identifier opf:scheme="MOBI-ASIN">B[A-Z0-9]{9}</dc:identifier>' "{}" \; \ | |
| | grep -E --only-matching 'B[A-Z0-9]{9}' | sort | tee ~/calibre-list-mobi-asin.v`date +"%Y%m%d"`.txt | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment