<s> import sys <EOL> import json <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> prog_name = sys . argv [ <NUM_LIT:0> ] <EOL> if len ( sys . argv ) < <NUM_LIT:3> : <EOL> sys . stderr . write ( "<STR_LIT>" % prog_name ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> sort_key = sys . argv [ <NUM_LIT:1> ] <EOL> if sort_key != '<STR_LIT>' and sort_key != '<STR_LIT>' and sort_key != '<STR_LIT:title>' : <EOL> sys . stderr . write ( '<STR_LIT>' % ( prog_name , sort_key ) ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> list_of_raw_dumps = sys . argv [ <NUM_LIT:2> : ] <EOL> summary_list = [ ] <EOL> for d in list_of_raw_dumps : <EOL> j = json . load ( open ( d ) ) <EOL> for c in j : <EOL> m = c [ '<STR_LIT>' ] <EOL> summary_list . append ( { '<STR_LIT>' : m [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : m [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : m [ '<STR_LIT>' ] , <EOL> '<STR_LIT:title>' : m [ '<STR_LIT:title>' ] } ) <EOL> summary_list . sort ( key = lambda x : x [ sort_key ] . lower ( ) ) <EOL> for s in summary_list : <EOL> sys . stdout . write ( s [ '<STR_LIT>' ] + '<STR_LIT>' + s [ '<STR_LIT>' ] + '<STR_LIT>' + <EOL> s [ '<STR_LIT>' ] + '<STR_LIT>' + s [ '<STR_LIT:title>' ] + '<STR_LIT:\n>' ) </s>
