|
|
|
|
|
by asicsp
3177 days ago
|
|
you can still do `< test.txt grep ...` see https://en.wikipedia.org/wiki/Cat_(Unix)#UUOC_.28Useless_Use... >Beyond other benefits, the input redirection forms allow command to perform random access on the file, whereas the cat examples do not. This is because the redirection form opens the file as the stdin file descriptor which command can fully access, while the cat form simply provides the data as a stream of bytes. commands like `sort` are optimized to handle large input file and how would you do `grep -l 'foo' *.txt` if you use `cat`? or `awk 'NR==FNR{a[$1]; next} $1 in a' file1 file2` or `grep -Fxf file1 file2` and so on.... |
|