How can we concatenate results from stdout (or stderr) and a file into a final file.For example ls -a | grep text1concatenate with file2.txt into a final result (not file2.txt), without storing grep text1 to something intermediate such as grep text1 > file1.txt
Concatenate contents from stdout and from file
cat;stdout;output
ls -a | grep text1 | cat file2.txt -The - stands for standard input. Alternatively you may writels -a | grep text1 | cat - file2.txtto have the output in different order.Yet another possibility using process substitution:cat <(ls -a | grep text1) file2.txtor in different order:cat file2.txt <(ls -a | grep text1)