Find the answer to your Linux question:
Results 1 to 2 of 2
Hi...I am new to linux... Please Help me in solving this.. I have two files like PID USERNAME PROCESSNAME %CPU Another File With PID TOTAL This file I ve like ...
  1. #1
    Just Joined!
    Join Date
    Sep 2010
    Posts
    0

    Hi

    Hi...I am new to linux...
    Please Help me in solving this..
    I have two files
    like PID USERNAME PROCESSNAME %CPU

    Another File With PID TOTAL
    This file I ve like
    PID
    303
    Total 87908K
    12343
    Total 65785K

    I need to check these two wid PIDs and if they match add TOTAL to the PID USERNAME PROCESSNAME %CPU TOTAL.....

    PIDs in two files are not in exact sorted manner....
    I had a try lyk

    rm /scripts/xy.txt
    rm /scripts/logs/cpu.txt
    a=`prstat 5 1|awk '{print $1" "$2" "$8" "$10}'`
    echo $a
    for pid in $a
    do
    echo $pid>>/scripts/xy.txt
    pmap $pid|grep -i total>>/scripts/xy.txt
    cat /scripts/xy.txt | awk '{print $2}' >> /scripts/logs/cpu.txt
    done



    Thanks in advance
    With Regards
    Deepa

  2. #2
    Linux Enthusiast MASONTX's Avatar
    Join Date
    May 2010
    Location
    Mason Texas
    Posts
    719
    Welcome to the forum. Glad you decided to join us.

Posting Permissions

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