Skip to content

Instantly share code, notes, and snippets.

@cmlh
Last active August 29, 2015 14:10
Show Gist options
  • Save cmlh/17c534e18199cb5ad675 to your computer and use it in GitHub Desktop.
Save cmlh/17c534e18199cb5ad675 to your computer and use it in GitHub Desktop.
#!/bin/bash
directories=(
'dir1'
'dir2')
function search {
res=$(unzip -c \*.mtgx Graphs/Graph1.graphml 2>&1 |egrep "(Archive: )|$1" |grep "<mtg:Value" -B1)
res=$(echo -e "$res" |sed 's/\<mtg\:Value\>//g')
res=$(echo -e "$res" |sed 's/\<\/mtg\:Value\>//g')
echo -e "$res"|grep -v "<"
}
for dir in "${directories[@]}"; do
cd "$dir" && search $1
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment