hi
ls -l * | sed 's/[ \t ]\+/ /g' | cut -f5 -d " " >out1
ls -l * | sed 's/[ \t ]\+/ /g' | cut -f5 -d " " >out2
diff out1 out2
i tried this it will work fine and i can see difference
but i need a script which should neglect, if the difference b/w files is small
and
it should display if difference is too large
thanks
revenna
swat
2
use du command for both the files and then compare
Hi,
read size1 junk < <(du -bcs * | tail -1)
read size2 junk < <(du -bcs * | tail -1)
gives you the total of all files in the folder in bytes.
You can compare them with:
[[ $size1 > $size2 ]] && echo "$size1 is greater than $size2" || echo "$size2 is greater than $size1
"
HTH Chris
thanks chris
it gives total file size of all files
i need to compare line by line with two files
thanks revenna
This should enable you to do what you want.
while read size1 junk1 <&4
do
read size2 junk2 <&5
[[ $size2 -eq $size1 ]] && echo "size is equal"
done \
4< <(du -b *) \
5< <(du -b *)