I have different text files and different outputs from different sources. I need to have the output on different lines on a text document file. The code is as follows
for (( x = 1 ; x < 1000 ; x++ )) do
difference=$((file1 - file2))
echo $(tshark -r 1.pcap -c 1 -t ad | \
awk -F" " '{print $2,$3}') $difference \
$(awk 'FNR == "'$z'" {print}' 1.txt) >> ~/Desktop/information.txt
done
It works fine, but it takes a long time. I beleive it is because the script is accessing the text document many times in a loop. Any idea how to use other approaches to enhance the speed performance?
Thanks
You can start with taking the redirection out of the loop: