Code: Select all
awk -F'=' '/primitive/ {n=$2} /id/ {i=$2} /rarity/ {r=$2} {if (/rarity/) {printf ("%s\t%s\t%s\n",substr(n,1,length(n)-1),substr(i,1,length(i)-1),substr(r,1,length(r)-1))}}' _cards.dat
It also works together with 'find' for parsing multiple sets.
Code: Select all
find . -name "_cards.dat" | xargs awk -F'=' '/block/ {n=$2} /primitive/ {p=$2} /id/ {i=$2} /rarity/ {r=$2} {if (/rarity/) {printf ("%s\t%s\t%s\t%s\n",substr(n,1,length(n)-1),substr(p,1,length(p)-1),substr(i,1,length(i)-1),substr(r,1,length(r)-1))}}' > setcards.csv