def get_script_args(options): global sort_fields, field_list field_list = zd_lib.get_field_list_wrapper() script_args = [] script_args.append('') length = len(sort_fields) numeric = -1 if options.numeric: numeric = field_list.index(options.numeric) for i in range(0, length): try: index = field_list.index(sort_fields[i]) other_option = '' if numeric == field_list[i]: other_option = 'n' if length > 1 and i != length-1: script_args.append('-k') script_args.append(str(index+1) + ',' + str(index+1) + other_option) else: script_args.append('-k') script_args.append(str(index+1) + other_option) except IOError, e: if e.errno == errno.EPIPE: exit(0)
def get_script_args(): field_list = zd_lib.get_field_list_wrapper() field_nums = '' script_args = [''] indexes = [] field_nums = [] for i in range(0, len(cut_fields)): try: index = field_list.index(cut_fields[i]) indexes.append(index) field_nums.append(str(index+1)) except IOError, e: if e.errno == errno.EPIPE: exit(0)