Sponsored Content
Full Discussion: Peak Ram Usage
Top Forums UNIX for Beginners Questions & Answers Peak Ram Usage Post 302983387 by dellanicholson on Monday 10th of October 2016 10:44:03 PM
Old 10-10-2016
Thank for your help. I want to get my code running. I realized I need to get the code working before adding the shell script code to zenity dialog i. Here is what I am trying to do


The first part of the code check if the input of a particular date and group name exist in a text file. The input values need to match on that entire record in the text file. This process is similar to SQL where clause statement.

The second part of the code display an error message and exit the loop if there isn't a match or else continue if there is a match. The date format needs to change from mm/dd/yyyy to mm/dd/yy in the output of results. The input variable n limit the number of records that are displayed.

I'm getting an error message when I run my code. Error message:
Code:
 too many errors to read

.

a) Input variables in the code are
Code:
group=hasasvmi
date1=09/29/2016
n=1

b) The following is the data in the text file
Example 1: data in disk_2016.09.29.txt :

Code:
/dev/sasdwk/hasasvmi 128 1 127  0% /sasdwk/hasasvmi  2016.09.29_11.30.27

c) The following is an example of the results that I want to display:



Code:
Filesystem                 GBks Free Used used%    Mt                  DT         TM                                                                     
/dev/sasdwk/hasasvmi 128   1      127    0%  /sasdwk/hasasvmi 09/29/16  11:30


Here is my code:

Code:
/bin/ksh
group=hasasvmi
date1=09/29/2016
n=1
|{
read "$group"
read "$date1"
read "$n"

DISKINFO=DISKINFO=$(tail -$n "/var/LV/$disk_$(date +"%Y.%H.%d").txt")

 WHILE IFS='' read $line

DO

        
       f1='grep ^"f1" $line | awk '{print $1}''
       f2='grep ^"f2" $line | awk '{print $2}''
       f3='grep ^"f3" $line | awk '{print $3}''
       f4='grep ^"f4" $line | awk '{print $4}''
       f5='grep ^"f5" $line | awk '{print $5}''
       f6='grep ^"f6" $line | awk '{print $6}''
       Date= $(date +%m/%d/%Y | gawk  "$line" 'BEGIN {FS=". _" OFS="/"} {print $7}'')
       Time= $(date +"%H:%M" | gawk "line" 'BEGIN {FS="_ ." OFS="."} {print $7}'')

  if[${date1}==${Date}] && [grp] THEN'

 printf '\tFileSystem%s\tGBks%d%s\t Free%d%s\tused%d %s\tused%%s\ tMt %s\ tDate%s\ tTime%s\n'     
                   "$f1" "$f2" "$f3" "$f4" "$f5"  "$Date" "$Time" 
     ELSE
             echo '$grp ' doesn't exist (exit)|| echo  '$f7' doesn't match the date on file for'$grp' (exit)

    fi

DONE <"$DISKINFO"
(



Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!

Last edited by RudiC; 10-11-2016 at 04:28 AM.. Reason: Added CODE tags.
 

10 More Discussions You Might Find Interesting

1. Solaris

RAM Physical Memory usage by each Process.

Hi All, I am trying to find the physical memory usage by each process/users. Can you please let me know how to get the memory usage?. Thanks, bsraj. (12 Replies)
Discussion started by: bsrajirs
12 Replies

2. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

3. UNIX for Dummies Questions & Answers

Command to check RAM usage

Hi Guys, How can i check the RAM usage for a particular user on the Linux machine. What command can be used. Thanks in advance, Swapna (1 Reply)
Discussion started by: Swapna173
1 Replies

4. Shell Programming and Scripting

RAM usage Information

Hi i just wanted to know what is the code to display amount of RAM and also the percentage used? I know i can possibly use the vmstat code but what part indicates the RAM? Any help would be much appreciated. Thanks (1 Reply)
Discussion started by: warlock129
1 Replies

5. Linux

Ram Usage

Hi one of our applications that runs on our Linux server leaks memory resulting in Ram that was used by the program not being released back to the operating system once a file has been processed. the result is over a very short period virtual all the memory has been used. an example currently ... (8 Replies)
Discussion started by: treds
8 Replies

6. Solaris

Server RAM Usage checkup & support

Hi RAM of my system is 24 GB however when i checked the processes pids and counted the memory usage by pmap i found out that the total memory usage is 36 GB It s obvious that my system might be using some of virtual memory or swap space . How can i check which memory it is using and how .. ... (9 Replies)
Discussion started by: Paarth
9 Replies

7. Red Hat

High RAM usage, extremely low swapping

Hi team I have three physical servers running on Red Hat Enterprise Linux Server release 6.2 with the following memory conditions: # cat /proc/meminfo | grep -i mem MemTotal: 8062888 kB MemFree: 184540 kB Shmem: 516 kB and the following swap conditions: ... (6 Replies)
Discussion started by: hedkandi
6 Replies

8. OS X (Apple)

RAM Usage discrepancy

Hey there! I'm a new user here who registered because I couldn't get these kind of questions answered in the place I directly com from. :o I've found a discrepancy in total RAM used and I can't figure out why it is. My only guess is there are some RAM used by some stuff impossible to identify,... (2 Replies)
Discussion started by: dasx
2 Replies

9. UNIX for Dummies Questions & Answers

Average CPU and RAM usage for a process

Hi, I will be creating a process myself and I want to know the average CPU and RAM used by the process over the lifetime of the process. I see that there are various tools available(pidstat) for doing , I was wondering if it possible to do it in a single command while creation. Thanks in... (3 Replies)
Discussion started by: koustubh
3 Replies

10. UNIX for Advanced & Expert Users

Ubuntu 14.04 - how to less ram usage

Hello, I have an ubuntu14.04 installed pc with 32GB ram. Operating System: Ubuntu 14.04.5 LTS Kernel: Linux 4.9.148-xxxx-std-ipv6-64 Architecture: x86_64 When I check free memory it shows: total used free shared buffers cached Mem: 31882 ... (2 Replies)
Discussion started by: baris35
2 Replies
All times are GMT -4. The time now is 01:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy