use -pipe, fix regex, fix input file detection