Jan-29-2019, 01:24 AM
i even had some uses for this script today. it merges each line of input between each argument from the command then outputs as many lines as it inputs. typical uses involve file names or other lists. normally 2 arguments are required. but you can make them be empty strings.
between.py
between.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import print_function from sys import argv,stdin,stderr argcount=len(argv) if argcount<3: print('need 2 or more arguments',file=stderr) exit(1) for input in stdin: if not input: continue while input and ord(input[-1])<32: input=input[:-1] output=argv[1] for argx in range(2,argcount): output=output+input+argv[argx] print(output)