here are the accompanying two charges:
grep ‘substring1’ file1.txt > outfile.txt
grep ‘substring2’ file2.txt > outfile.txt
I might want to combine the two greps, and think of all to outfile.txt as one charge. How might such summon resemble?
You can easily combine both commands in a row, like:
grep ‘substring1’ file1.txt > outfile.txt ; grep ‘substring2’ file2.txt >> outfile.txt
The “;” separate both commands, the second command will be executed after the first has finished.
The “>>” means you append the output to the already existing file. (if the file does not exists, there will be no difference to “>”)
You can use this simple pattern for many different tasks.