Find the answer to your Linux question:
Results 1 to 2 of 2
Hi All, I have this small issue where in I want to get partial output of the "ll" command into a logfile, I will explain in detail. after running a ...
  1. #1
    Just Joined!
    Join Date
    Oct 2007
    Posts
    14

    Accumulating logfiles with header

    Hi All,

    I have this small issue where in I want to get partial output of the "ll" command into a logfile, I will explain in detail.

    after running a particular script the logfiles that are generated are listed below:


    RS80:/home/DTEDIT/new_build/HEAD/lastrun-logs # ll
    total 1313
    drwxr-xr-x 2 postgres postgres 712 Nov 1 01:16 .
    drwxr-xr-x 4 postgres postgres 208 Nov 1 01:16 ..
    -rw-r--r-- 1 postgres postgres 25508 Nov 1 01:01 CVS.log
    -rw-r--r-- 1 postgres postgres 301830 Nov 1 01:12 check.log
    -rw-r--r-- 1 postgres postgres 236383 Nov 1 01:01 config.log
    -rw-r--r-- 1 postgres postgres 12793 Nov 1 01:01 configure.log
    -rw-r--r-- 1 postgres postgres 34930 Nov 1 01:15 contrib-install-check.log
    -rw-r--r-- 1 postgres postgres 110059 Nov 1 01:16 ecpg-check.log
    -rw-r--r-- 1 postgres postgres 1236 Nov 1 01:13 initdb.log
    -rw-r--r-- 1 postgres postgres 228205 Nov 1 01:14 install-check.log
    -rw-r--r-- 1 postgres postgres 21263 Nov 1 01:15 install-contrib.log
    -rw-r--r-- 1 postgres postgres 38261 Nov 1 01:13 make-contrib.log
    -rw-r--r-- 1 postgres postgres 54722 Nov 1 01:13 make-install.log
    -rw-r--r-- 1 postgres postgres 196904 Nov 1 01:12 make.log
    -rw-r--r-- 1 postgres postgres 20409 Nov 1 01:15 pl-install-check.log
    -rw-r--r-- 1 postgres postgres 237 Nov 1 01:13 startdb-1.log
    -rw-r--r-- 1 postgres postgres 237 Nov 1 01:14 startdb-2.log
    -rw-r--r-- 1 postgres postgres 237 Nov 1 01:15 startdb-3.log
    -rw-r--r-- 1 postgres postgres 225 Nov 1 01:14 stopdb-1.log
    -rw-r--r-- 1 postgres postgres 224 Nov 1 01:15 stopdb-2.log
    -rw-r--r-- 1 postgres postgres 224 Nov 1 01:15 stopdb-3.log
    -rw-r--r-- 1 postgres postgres 5016 Nov 1 01:16 web-txn.data



    Now I want this listing to go to another logfile but the format in which I want that to go is as below:


    * Run Date: Thu 18Oct2007
    * Run Time Start: 11:50:04
    * Run Time End: 12:06:45
    * Log files status:
    * [cvs.log] {dateTimeStamp}
    * [config.log] {dateTimeStamp}
    * [configure.log] {dateTimeStamp}
    * [make.log] {dateTimeStamp}
    * [check.log] {dateTimeStamp}
    * [make-contrib.log] {dateTimeStamp}
    * [make-install.log] {dateTimeStamp}
    * [initdb.log] {dateTimeStamp}
    * [startdb-1.log] {dateTimeStamp}
    * [install-check.log] {dateTimeStamp}
    * [startdb-2.log] {dateTimeStamp}
    * [stopdb-1.log] {dateTimeStamp}
    * [pl-install-check.log] {dateTimeStamp}
    * [startdb-3.log] {dateTimeStamp}
    * [stopdb-2.log] {dateTimeStamp}
    * [install-contrib.log] {dateTimeStamp}
    * [contrib-install-check.log] {dateTimeStamp}
    * [stopdb-3.log] {dateTimeStamp}
    * [ecpg-check.log] {dateTimeStamp}
    * [web_txn.data] {dateTimeStamp}


    Where in the rundate and time is the date and time when the script started running, Run time end is the end of the script and each and every logfile should have the date and time stamp as it shows when you run the "ll" command after the log files are generated.

    Please tell me how will I be able to do that.
    Note : I am using SUSE Linux 9

    Thanks in advance
    Regards
    Cinu Kuriakose

  2. #2
    Just Joined!
    Join Date
    Oct 2007
    Posts
    14
    Hi Everybody,

    I was able to format the command in the following way as shown below and I got the desired reply:

    ls -lt /home/DTEDIT/new_build/REL8_2_4/lastrun-logs|awk '{print $9 $6 $7 $8}'

    .Oct3103:55
    runBuild_log_10302007_2300.logOct3023:17
    ..Oct3023:16
    web-txn.dataOct3023:16
    ecpg-check.logOct3023:16
    stopdb-3.logOct3023:15
    contrib-install-check.logOct3023:15
    install-contrib.logOct3023:14
    startdb-3.logOct3023:14
    stopdb-2.logOct3023:14
    pl-install-check.logOct3023:14
    startdb-2.logOct3023:14
    stopdb-1.logOct3023:14
    install-check.logOct3023:14
    startdb-1.logOct3023:13
    initdb.logOct3023:13
    make-install.logOct3023:13
    make-contrib.logOct3023:13
    check.logOct3023:11
    make.logOct3023:11
    config.logOct3023:02
    configure.logOct3023:02
    CVS.logOct3023:01

    Hence I got the output what I wanted, but now I am facing another issue, I want that in the above output along with the date it should show the year also, I will display one example with the last log:


    "CVS.logOct30, 2007 23:01"

    This is the output which I want now.

    Please reply back for the above query.

    Thanks in advance
    Regards
    Cinu





    Quote Originally Posted by cheriyamoozhiyilcinu View Post
    Hi All,

    I have this small issue where in I want to get partial output of the "ll" command into a logfile, I will explain in detail.

    after running a particular script the logfiles that are generated are listed below:


    RS80:/home/DTEDIT/new_build/HEAD/lastrun-logs # ll
    total 1313
    drwxr-xr-x 2 postgres postgres 712 Nov 1 01:16 .
    drwxr-xr-x 4 postgres postgres 208 Nov 1 01:16 ..
    -rw-r--r-- 1 postgres postgres 25508 Nov 1 01:01 CVS.log
    -rw-r--r-- 1 postgres postgres 301830 Nov 1 01:12 check.log
    -rw-r--r-- 1 postgres postgres 236383 Nov 1 01:01 config.log
    -rw-r--r-- 1 postgres postgres 12793 Nov 1 01:01 configure.log
    -rw-r--r-- 1 postgres postgres 34930 Nov 1 01:15 contrib-install-check.log
    -rw-r--r-- 1 postgres postgres 110059 Nov 1 01:16 ecpg-check.log
    -rw-r--r-- 1 postgres postgres 1236 Nov 1 01:13 initdb.log
    -rw-r--r-- 1 postgres postgres 228205 Nov 1 01:14 install-check.log
    -rw-r--r-- 1 postgres postgres 21263 Nov 1 01:15 install-contrib.log
    -rw-r--r-- 1 postgres postgres 38261 Nov 1 01:13 make-contrib.log
    -rw-r--r-- 1 postgres postgres 54722 Nov 1 01:13 make-install.log
    -rw-r--r-- 1 postgres postgres 196904 Nov 1 01:12 make.log
    -rw-r--r-- 1 postgres postgres 20409 Nov 1 01:15 pl-install-check.log
    -rw-r--r-- 1 postgres postgres 237 Nov 1 01:13 startdb-1.log
    -rw-r--r-- 1 postgres postgres 237 Nov 1 01:14 startdb-2.log
    -rw-r--r-- 1 postgres postgres 237 Nov 1 01:15 startdb-3.log
    -rw-r--r-- 1 postgres postgres 225 Nov 1 01:14 stopdb-1.log
    -rw-r--r-- 1 postgres postgres 224 Nov 1 01:15 stopdb-2.log
    -rw-r--r-- 1 postgres postgres 224 Nov 1 01:15 stopdb-3.log
    -rw-r--r-- 1 postgres postgres 5016 Nov 1 01:16 web-txn.data



    Now I want this listing to go to another logfile but the format in which I want that to go is as below:


    * Run Date: Thu 18Oct2007
    * Run Time Start: 11:50:04
    * Run Time End: 12:06:45
    * Log files status:
    * [cvs.log] {dateTimeStamp}
    * [config.log] {dateTimeStamp}
    * [configure.log] {dateTimeStamp}
    * [make.log] {dateTimeStamp}
    * [check.log] {dateTimeStamp}
    * [make-contrib.log] {dateTimeStamp}
    * [make-install.log] {dateTimeStamp}
    * [initdb.log] {dateTimeStamp}
    * [startdb-1.log] {dateTimeStamp}
    * [install-check.log] {dateTimeStamp}
    * [startdb-2.log] {dateTimeStamp}
    * [stopdb-1.log] {dateTimeStamp}
    * [pl-install-check.log] {dateTimeStamp}
    * [startdb-3.log] {dateTimeStamp}
    * [stopdb-2.log] {dateTimeStamp}
    * [install-contrib.log] {dateTimeStamp}
    * [contrib-install-check.log] {dateTimeStamp}
    * [stopdb-3.log] {dateTimeStamp}
    * [ecpg-check.log] {dateTimeStamp}
    * [web_txn.data] {dateTimeStamp}


    Where in the rundate and time is the date and time when the script started running, Run time end is the end of the script and each and every logfile should have the date and time stamp as it shows when you run the "ll" command after the log files are generated.

    Please tell me how will I be able to do that.
    Note : I am using SUSE Linux 9

    Thanks in advance
    Regards
    Cinu Kuriakose

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...