I need help. I have to create a cron job that will reset the value of different and multiple .txt file to 0.
Example:
Actual
172_21.txt = 25
192_101.txt = 10
192_168.txt = 5
10_10.txt = 3
After the cron job
172_21.txt = 0
192_101.txt = 0
192_168.txt = 0
10_10.txt = 0
The cron job will be run every 12:00 Mid Night.
Thanks for the help.
If all lines of text are exactly xxx = xxx, i.e. two spaces and three set of characters:
for file in file1.txt file2.txt lastfile.txt
do
awk '{ print $1, $2, "0" }' $file > tmp.tmp
mv tmp.tmp $file
done
Thanks jim for the response. I tried the command you gave but it only append the 0 to the xxx. It doesn't overwrite the xxx with 0.