Is there a shorter way of writing this? Basically output a command to a file, then use the file as input for the next command. I also want to keep the file to view afterwards.
cmd1 > verylong.txt; cmd2 < verylong.txt
I know I can do
cmd1 | tee verylong.txt | cmd2
But since I expect "verylong.txt" to be a huge file, I thought it would be less efficient to use pipe since that would hold the entire file in memory. Whereas if I use file input then it would process it one line at a time. (Or is my assumption wrong?)
It would be great if I could do something elegant like
cmd1 > verylong.txt > cmd2
sort
doesn't store the whole file in memory, it's got a buffer with a maximum size as well and resorts to temporary files when that maximum is reached. – Stéphane Chazelas Nov 21 '14 at 15:26