I am looking for a command that will replace the old size value in log file by the new size. I just need the new value to replace the old value after the
:
in the log file.
ex :
when the script is looking the size of HOME_1, the new size (ex 1234578) will replace the old value 12345
Do you want to change one value in the file? Perhaps this:-
for label in HOME_1 HOME ACTARUS
do
du -ksx $label | read value rest
( grep -v "^$label:" filename ; echo "$label:$newvalue" ) > filename.tmp
mv filename.tmp filename
done
Does that help? You've not been too clear on your problem.
sorry to be confused. I am trying to be as clear as I can :
I am trying the replace numbers by numbers in a log file that looks like :
dir2:123
I need to avoid to change anything in the log file except the size of the directory.
ex
du -k /dir1/dir2/
output
456 /dir/1/dir2/
so a shell command will replace my old size value with the today's one. This must work whatever the directory size is bigger or smaller the last value.