Added check for file input (cat) and added pipe check