I am performing two operations in a single Linux command. The operations are:
Sending data from source file into a new target file.
Counting the number of records in the source file.
For example: source file:
a.txt, target file:
cat a.txt > b.txt; cat a.txt | wc -l
In the above example, I extract data from
a.txt twice to perform the two operations. However, my source file is very huge. So for better performance, I am trying to find a way to extract data from source file just once and perform both the operations.
How can I accomplish this?