Using "tail" command - Beginner question - Unix

This is a discussion on Using "tail" command - Beginner question - Unix ; Dear Sir/Madam We have an on-going program to run "top" command at certain time and generates the report below. We need to extract the 4 lines above the heading "PID USERNAME LWP......" to another file. Could we use "tail" command ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Using "tail" command - Beginner question

  1. Using "tail" command - Beginner question

    Dear Sir/Madam

    We have an on-going program to run "top" command at certain time and
    generates the report below. We need to extract the 4 lines above the
    heading "PID USERNAME LWP......" to another file. Could we use "tail"
    command to do that ? If yes, what option should we use. If you have
    better suggestion, please let me know also.

    Thanks, Bill


    :
    :
    :
    :
    :
    :
    :
    load averages: 0.21, 0.12, 0.12
    13:43:19
    156 processes: 155 sleeping, 1 on
    cpu
    CPU states: 98.6% idle, 0.2% user, 0.5% kernel, 0.7% iowait, 0.0%
    swap
    Memory: 12G real, 7511M free, 2652M swap in use, 11G swap
    free

    PID USERNAME LWP PRI NICE SIZE RES STATE TIME CPU COMMAND
    828 root 7 58 0 12M 8488K sleep 221:59 0.22%
    BESClient
    2649 root 62 0 10 226M 154M sleep 296:30 0.19% java
    9547 root 1 58 0 7136K 3280K sleep 0:00 0.15% sshd2
    9575 izzy 1 55 0 2896K 1840K cpu/9 0:00 0.06% top
    18597 poppy 20 58 0 23M 10M sleep 18:49 0.05% opmn
    18698 poppy 17 58 0 129M 58M sleep 109:08 0.05% emagent
    9544 l1ocwdv 1 58 0 950M 863M sleep 0:00 0.03% oracle
    9550 izzy 1 40 0 1928K 1344K sleep 0:00 0.02% ksh
    13375 daisy 1 58 0 952M 870M sleep 20:39 0.02% oracle
    2406 root 9 58 0 7424K 5080K sleep 2:47 0.02%
    sisidsdaemon
    13379 daisy 1 58 0 950M 855M sleep 12:17 0.01% oracle
    18607 dairy 30 28 10 309M 140M sleep 8:55 0.01% java
    13369 daisy 15 58 0 958M 869M sleep 9:18 0.01% oracle
    650 root 8 40 0 3416K 2424K sleep 0:40 0.01% nscd
    13505 izzy 1 58 0 515M 450M sleep 9:09 0.01%
    oracle <---- end of report

  2. Re: Using "tail" command - Beginner question

    underh20.scubadiving@gmail.com wrote:
    > Dear Sir/Madam
    >
    > We have an on-going program to run "top" command at certain time and
    > generates the report below. We need to extract the 4 lines above the
    > heading "PID USERNAME LWP......" to another file. Could we use "tail"
    > command to do that ? If yes, what option should we use. If you have
    > better suggestion, please let me know also.
    >
    > Thanks, Bill



    Hi Bill

    top | head -4 > output

    cheers

    Sam


  3. Re: Using "tail" command - Beginner question

    underh20.scubadiving@gmail.com wrote:
    > Dear Sir/Madam
    >
    > We have an on-going program to run "top" command at certain time and
    > generates the report below. We need to extract the 4 lines above the
    > heading "PID USERNAME LWP......" to another file. Could we use "tail"
    > command to do that ? If yes, what option should we use. If you have
    > better suggestion, please let me know also.
    >
    > Thanks, Bill



    Hi Bill

    top | head -4 > output

    cheers

    Sam


+ Reply to Thread