Speed ​​difference in explicit redirection

What's the difference between

sed -ne '10{p;q;}' file.txt

&

sed -ne '10{p;q;}' <file.txt 

?

I know what I'm doing sedhere, and all that bothers me is a way to enter data. Just that I took an example sed.

I believe ( this could also be a serious misunderstanding ) in both cases, similar to the ones below:

 exec 4<&0; exec 0<file.txt;sed -ne '10{p;q;}'-;exec 0<&4

happens (at 4, I just mean the temporary file descriptor).

So both should be equally fast. Am I wrong ?

+4
source share
1 answer

, sed, , () , . . grep ( GNU grep), fd stdin.

+2

All Articles