I am in the process of writing a script to download server logs, use a perl script to parse it for information, do a bunch of processing, and create a report. As a part of this report, I need to do a simple line count of a csv file, and ideally store this in a variable withing the script.
I don't understand redirection, and I don't even know if what I am trying to do is possible with Bash. Anyhow, here is the redirect portion
I don't understand redirection, and I don't even know if what I am trying to do is possible with Bash. Anyhow, here is the redirect portion
Code:
exec 6>&1 #redirect stdout
exec > $COUNT
for file in cop.csv; do
grep EWP-COP $file | wc -l
done
exec 1>&6 6>&-