No, you can't.
While there are many programs, like most of the common text processing tools (sed
, cut
, grep
etc.) that read the data to process from files listed as command line arguments, or read it from stdin if no files are given, that's not the case for all programs there are. Command line arguments are different from data provided via stdin, and it's wholly up to the program how to process them.
The obvious counterexamples are programs like rm
, which don't read stdin at all, but even with ones where you might think the equivalence would hold, there are filter-like commands such as tr
and wc
which don't take a filename arg at all, or produces different output.
The command line syntax of tr
is roughly:
tr [options] string1 [string2]
It doesn't take any filenames as arguments, but always reads its stdin.
Hence, turning
< file.txt tr abc xyz
into
tr abc xyz file.txt
will just produce an error.
As mentioned in the comments, wc
is another common tool that also behaves differently, though it's a bit less extreme. With the filename given, it includes it in the output (even if there's only one, unlike with grep
):
$ wc hello.txt
1 1 4 hello.txt
$ wc < hello.txt
1 1 4
Also many programs take the filename -
as an explicit instruction to read stdin, but the shell doesn't support that. So while cat < -
reads a file called -
, cat -
reads from cat
's stdin, likely the terminal.