2 added 765 characters in body
source | link

UPDATE

To traverse the directory, I'm using the following code:

list=(temp-system build-system)
for direcs in ${list[@]}; do
    case $direcs in
        temp-system )
            pushd $direcs
                _list1=(bash binutils build-variables)
                for subdirecs in ${_list1[@]}; do
                    case $subdirecs in
                        * )
                            # execute code to add the time
                            # and later add this with other
                            # time calculated from other directories
                            ;;
                    esac
                done
            popd;;
    esac
done

UPDATE

To traverse the directory, I'm using the following code:

list=(temp-system build-system)
for direcs in ${list[@]}; do
    case $direcs in
        temp-system )
            pushd $direcs
                _list1=(bash binutils build-variables)
                for subdirecs in ${_list1[@]}; do
                    case $subdirecs in
                        * )
                            # execute code to add the time
                            # and later add this with other
                            # time calculated from other directories
                            ;;
                    esac
                done
            popd;;
    esac
done
1
source | link

Add time from all log files using bash

I want to extract time from all of my .log files and add all of these times into a single entity. My log files are placed in nested directories.

Directory structure for my log files:

|-- temp-system
|   |-- bash
|   |   |-- bash-4.3-branch_update-5.patch
|   |   |-- build.log
|   |   |-- build.sh
|   |   `-- DONE
|   |-- binutils
|   |   |-- build.log
|   |   |-- build.sh
|   |   `-- DONE
|   |-- build-variables
|   |   |-- build.log
|   |   |-- build.sh
|   |   `-- DONE
|   |-- bzip2
|   |   |-- build.log
|   |   |-- build.sh
|   |   `-- DONE
|   |-- check
|   |   |-- build.log
|   |   |-- build.sh
|   |   `-- DONE
|   |-- cloog
|   |   |-- build.log
|   |   |-- build.sh
|   |   `-- DONE
|   |-- gettext
|   |   |-- build.log
|   |   |-- build.sh
|   |   `-- DONE
|-- build-system
|   |-- gcc
|   |   |-- build.log
|   |   |...

Snippet of my log files:

are/man/man1'
make[2]: Leaving directory `/tmp/panda64/temp-system/texinfo/texinfo-5.2/man'
make[1]: Leaving directory `/tmp/panda64/temp-system/texinfo/texinfo-5.2/man'
make[1]: Entering directory `/tmp/panda64/temp-system/texinfo/texinfo-5.2'
make[2]: Entering directory `/tmp/panda64/temp-system/texinfo/texinfo-5.2'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/tmp/panda64/temp-system/texinfo/texinfo-5.2'
make[1]: Leaving directory `/tmp/panda64/temp-system/texinfo/texinfo-5.2'
/tmp/panda64/temp-system/texinfo

real    1m59.973s
user    1m26.352s
sys     0m11.820s

Every log file has these last three lines real, user and sys. I want to extract all these out of my log files and add them and output in a format HH:MM:SS. I was trying to achieve this using cat and grep but haven't been able to get the regex right.