Sponsored Content
Full Discussion: Total space Determination
Operating Systems Linux Red Hat Total space Determination Post 302288520 by Franklin52 on Tuesday 17th of February 2009 01:16:32 PM
Old 02-17-2009
Quote:
Originally Posted by William1482
i cannot understand this coding.Could you please explain me briefly on this?

Thanks $ Regards,
William
Code:
awk 'NR==1{next}

Skip the 1st line.

Code:
split($4,f,"G")>1{$4=f[1]*1024}

The split function is used to search for a "G" in the 4th field and to separate the last letter from the numeric value. If the last letter of the 4th field is a "G", f[1] holds the value of the available Gigabytes, f[2] holds the "G" and the return code is 2 otherwise the return code is 1.
If the returncode > 1 the value is multiplied with 1024 (to Megabytes) and assigned to the 4th field.

Code:
{sub("M","",$4);s+=$4}

The sub function deletes the "M" from field $4 (if it's available). The next statement adds the value of the 4th field to the variable s.

Code:
END{print "Available: " s "M"}'

After processing the last line, print the sum of available Megabytes.

Regards
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Hardware Determination

Does anyone know an equiv of lscfg -vp for HP-UX? (2 Replies)
Discussion started by: sam_pointer
2 Replies

2. UNIX for Dummies Questions & Answers

df+du=Total space allocated(for a file system)

Hi All, Will df+du=Total space allocted for a file system?? Is the above correct. Please correct me If iam wrong. In one my programs the above is not happening. Please help me out. Many thanks. Regards, Manas (2 Replies)
Discussion started by: manas6
2 Replies

3. AIX

used PPs not match the total disk space showed by df

Hi, I see from lsvg the total used PPs is 1050 (67200 megabytes), but when I check the disk space with df command I can only see 31G total space, can somebody tell how this come? Thanks! Victor # lsvg rootvg # lsvg rootvg VOLUME GROUP: rootvg VG IDENTIFIER: ... (2 Replies)
Discussion started by: victorcheung
2 Replies

4. Shell Programming and Scripting

Calculate total space, total used space and total free space in filesystem names matching keyword

Good afternoon! Im new at scripting and Im trying to write a script to calculate total space, total used space and total free space in filesystem names matching a keyword (in this one we will use keyword virginia). Please dont be mean or harsh, like I said Im new and trying my best. Scripting... (4 Replies)
Discussion started by: bigben1220
4 Replies

5. Solaris

swap size, total disk space

Hi experts, In my solaris system when i run the command df -h i got the below response.I have some confusion which i want to share with you guys.1)there are two SWAP file system shows are they same or different?2)if i want to count the total disk space should i take both the swap space or only... (2 Replies)
Discussion started by: rafiassam
2 Replies

6. Solaris

command to get the total disk space (available + free)

is there a command to get the total disk space (available + free) on the solaris server ? thanks (3 Replies)
Discussion started by: sudhiroracle
3 Replies

7. Emergency UNIX and Linux Support

Calculating total space in GB for all files with typical pattern

Hi Experts, In a particular dir, I have many files *AJAY*. How can I get total size of all such files. I tried du -hs *AJAY* but it gave me individual size of all files. All I require is summation of all. Thanks, Ajay (4 Replies)
Discussion started by: ajaypatil_am
4 Replies

8. Solaris

Problem in getting total Disk space using iostat -En command

Hi Everyone, I try to calculate the total hard disk space of a solaris machine using iostat -En command. Iterating the output and summing up all the number present near the Size: will give the exact size of the harddisk. But it is not working for a machine. This command works in many flavors... (2 Replies)
Discussion started by: prasankn
2 Replies

9. Red Hat

Total storage space and Serial number

Hi, Could you please tell me the commands to find Total storage space and Serial number of Linux server. OS -- Red Hat Enterprise Linux Server release 6.6 (Santiago) This is 2 node cluster. Regards, Maddy (1 Reply)
Discussion started by: Maddy123
1 Replies
csx_Error2Text(9F)					   Kernel Functions for Drivers 					csx_Error2Text(9F)

NAME
csx_Error2Text - convert error return codes to text strings SYNOPSIS
#include <sys/pccard.h> int32_t csx_Error2Text(error2text_t *er); INTERFACE LEVEL
Solaris DDI Specific (Solaris DDI) PARAMETERS
er Pointer to an error2text_t structure. DESCRIPTION
This function is a Solaris-specific extension that provides a method for clients to convert Card Services error return codes to text strings. STRUCTURE MEMBERS
The structure members of error2text_t are: uint32_t item; /*the error code*/ char test[CS_ERROR_MAX_BUFSIZE}; /*the error code*/ A pointer to the text for the Card Services error return code in the item field is returned in the text field if the error return code is found. The client is not responsible for allocating a buffer to hold the text. If the Card Services error return code specified in the item field is not found, the text field will be set to a string of the form: "{unknown Card Services return code}" RETURN VALUES
CS_SUCCESS Successful operation. CS_UNSUPPORTED_FUNCTION No PCMCIA hardware installed. CONTEXT
This function may be called from user or kernel context. EXAMPLES
Example 1: : Using the csxError2Text function if ((ret = csx_RegisterClient(&client_handle, & client_reg)) != CS_SUCCESS) { error2text_t error2text; error2text.item = ret; csx_Error2Text(&error2text); cmn_err(CE_CONT, "RegisterClient failed %s (0x%x)", error2text.text, ret); } SEE ALSO
csx_Event2Text(9F) PC Card 95 Standard, PCMCIA/JEIDA SunOS 5.10 19 Jul 1996 csx_Error2Text(9F)
All times are GMT -4. The time now is 01:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy