I am not sure what you mean by sorting, but here is a little python script to check for duplicate txid's:
import json
from sys import argv, stdin
file = stdin.read() #reads transaction list from input
json_file = json.loads(file)
#counts the number of duplicate txid's
txid_list = [transaction["txid"] for transaction in json_file]
print "There are", len(txid_list) - len(set(txid_list)), "duplicates"
Let's suppose that you save this to a file named check_duplicates.py. Now you just need to output the transactions to a file and feed it to the script:
$ ./bitcoind -datadir=1 listtransactions "*" > transactions.log
$ python check_duplicates.py < transactions.log
There are N duplicates
Depending on what you need, other sorting operations can be done. It's easy to manage json with python.
Are you asking for a shell script? Or code? If code, what language? – David Schwartz – 2011-09-07T20:02:34.307
Either, and whichever has the smallest learning curve =) – Alex Waters – 2011-09-08T03:02:39.893
"Sort the output" is not really specific. Outputting to a file is done with the > operator. If you want to do more that just output to a file, you must use a scripting language. It would help if you tell us what you want to do and in what language. – nmat – 2011-09-08T05:20:25.080
The command I am executing in my question outputs text into the terminal window. I would like to parse that text to compare the lines containing txid. I don't know what language would be best for this. – Alex Waters – 2011-09-08T05:27:49.350
What do you mean compare? If you want to analyze the data yourself, you can output to a file and manually select what you need:
./bitcoind -datadir=1 listtransactions "*" > transactions.logIf it is a more automated procedure like removing duplicates or filtering some transactions, we can give you a few pointers/examples on a scripting language. – nmat – 2011-09-08T05:32:45.747