6
votes
6answers
2k views

How to write a script that accepts input from a file or from stdin?

How can one write a script that accept input from either a filename argument or from stdin? for instance, you could use less this way. one can execute less filename and equivalently cat filename | ...
2
votes
1answer
190 views

Using the same file as stdin and stdout results in empty file

If want to filter a file but if I use the same file as input and output the output file is empty. Is there another solution instead of using a second file? php -r "echo preg_replace('~/\* DEV ...
0
votes
1answer
374 views

Is it possible in ffmpeg to seek to position of the file that is received through stdin

Is it possible to -ss in ffmpeg to the file, that is being received via pipe? So that I start reading it from a given timecode? I am not encoding the file. Thanks