Hi Guys,
If someone can help me edit my script using sed or awk that will be great.
I am trying to get a list of folders and their sizes upto 2 levels along with the week number by using following -
(I am currently putting this information in a file and plan to run this script EVERY week)
PHP Code:
du -h --max-depth=2 * | awk '{print $1, $2}'
I can get the week number using -
PHP Code:
echo "Week $(date +%U)"
Output - Week 41
Now, I need to format it in a way where after running each week (say Monday), it should append the output on each line, so combined output should look something like this -
PHP Code:
Folder;Week 42;Week 43;Week 44; ...
./test-folder/2011;13G;15G;275G
./system/2011;128G;150G;180G
...
Problem is I can arrange the first line output and am not able to append similar data when the script runs the second time. (For e.g, in above, I can't add Week 44, 275G recursively for the entire list of folders)
I was thinking of using a script like following though am not able to make it work.
PHP Code:
while read i
do
a=$(echo $i|awk '{print $2}')
echo $(echo $i $a.txt)
done < a
If someone can help me do the remaining stuff, that would be really great.
Cheers and thanks in advance,
Andrew
---------- Post updated 08-02-11 at 01:20 PM ---------- Previous update was 08-01-11 at 07:43 PM ----------
Can someone please shade some more information on this since I am still trying to use a combination of awk and sed though I am not able to make it work.