Skip to content

Instantly share code, notes, and snippets.

@nicolas-raoul
Created June 20, 2011 04:59
Show Gist options
  • Save nicolas-raoul/1035149 to your computer and use it in GitHub Desktop.
Save nicolas-raoul/1035149 to your computer and use it in GitHub Desktop.
A script to grep through an Anki deck
#!/bin/sh
#
# Search for a term within an Anki deck.
#
# Usage: grepdeck.sh somedeck.anki someword
#
# You might want to add such an alias to your .bashrc :
# alias gdj='~/programs/grepdeck.sh ~/decks/japanese.anki'
# Then usage becomes for instance: gdj 仕組み
DECK=$1
WORD=$2
sqlite3 $DECK 'select question, answer from cards' | sed 's/<\/\?span[^<>]*>//g' | grep -i $WORD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment