Sponsored Content
Full Discussion: formatting of df -k
Top Forums Shell Programming and Scripting formatting of df -k Post 302483242 by darsh123 on Friday 24th of December 2010 03:35:13 PM
Old 12-24-2010
Data formatting of df -k

Hello,

I am developing a platform Independant tool that should work for all major unix flavors outlined in this forum(Solaris,Linux, AIX, HPUX, SCO,BSD)

Therefore, in order to cover all types of user community, I have deliberately posted the same message on every forum. Please do not think of this as spamming multiple forums. This is one of a kind request and I do not wish to continue with this approach(of spreading same post to multiple forums)


Now the question:

HTML Code:
The output on df -k on HP looks like below

/r01                   (/dev/vgprj2app/vr01   ) : 207501014 total allocated Kb
                                                  33261948 free allocated Kb
                                                  174239066 used allocated Kb
                                                        83 % allocation used
/tmp                   (/dev/vg00/lvol4       ) : 11798652 total allocated Kb
                                                  11774476 free allocated Kb
                                                     24176 used allocated Kb
                                                         0 % allocation used
/usr                   (/dev/vg00/lvol7       ) :  4960928 total allocated Kb
                                                   2534000 free allocated Kb
                                                   2426928 used allocated Kb
On Solaris and others the same df -k will show the output in a very different format.

I am looking to massage above output to a comma delimited format to stream line the same format that will work as an input to Oracle databases.

HTML Code:
Mount,totalAllocated,FreeAllocated,usedAllocated,percent
"/r01",207501014,33261948,174239066,83
"/tmp",11798652,11774476,24176,0
"/usr",4960928,2534000,2426928,80
How can I massage the df -k ouput formats of various kinds into the one mentioned above using shell scripts? I heard that awk utility can do this, but I just dont know awk programming Smilie

Thanks,
D
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

formatting

I've been asking on IRC channels but no one answers me, I need to format my hard drive, normally it's just format c: but c doesn't exist, how do I format when I have linux mandrake installed. Please reply to this quickly, I'm kinda in a rush :( (1 Reply)
Discussion started by: darryll777
1 Replies

2. UNIX for Dummies Questions & Answers

formatting

is it possible to format a powerbook g4 mac? like totally erase the HD then pop in the Mac OS cd and it will boot up an install like windows or any linux? (5 Replies)
Discussion started by: xeron
5 Replies

3. UNIX for Dummies Questions & Answers

formatting

Hi Again Guys , Please i installed linux RH 6.1 on Toshiba , 10G , RAM=128 , 600 MHZ . After i installed linux i got many error messages , seems it was not installed correctly , also when i finished installation it did not ask me for the 2nd installation CD , and when i logged as root , i... (5 Replies)
Discussion started by: tamemi
5 Replies

4. Shell Programming and Scripting

Formatting

I have next part of script: for i in $LIST do echo "`date +"%H:%M:%S"` Converting $i ..."; mysql -uroot some -sABe "ALTER TABLE $i ENGINE=$ENGINE"; done I want to get following output formatting: "OK" must be one under another :) ... (3 Replies)
Discussion started by: mirusnet
3 Replies

5. Shell Programming and Scripting

formatting

I have file with different columns for ex. contents of file "txt" NAME AGE MARKS HARRY 23 89 TOM 12 67 BOB 23 11 and you see its not formatted.Now, I need the file "txt" to be formatted like COLUMN1 COLUMN2 COLUMN3 NAME AGE ... (3 Replies)
Discussion started by: vijay_0209
3 Replies

6. Shell Programming and Scripting

Formatting

Is there a way to make a 2 column output out of the following : 1 2 3 4 5 6 Output : 1 2 3 4 5 6 Thanks, Prasanna (3 Replies)
Discussion started by: prasanna1157
3 Replies

7. Shell Programming and Scripting

help formatting

I need to format a txt file and convert it in CSV. Any "future" column is separated by a newline. FROM: XS1 1.43294 0.0 XS2 1.21824 0.0 TO: XS1,XS2 (2 Replies)
Discussion started by: alfreale
2 Replies

8. Shell Programming and Scripting

Formatting Help

Hi Guys, i have report that runs every 10 min and send the report of failed jobs to my mail. Currently i am using a command like this to send mail. mailx -t -s "FAILURE JOBS IN HYDRA $temp_date" addressee@domain.com < temp_file5 But i am getting mail in this format ....... (4 Replies)
Discussion started by: gkrish
4 Replies

9. Shell Programming and Scripting

Formatting

Good day All, I have requirement where my input data looks like below ] Message5 Expecting Output as 04/MAR/2104 ||| 23:15:45 ||| servername ||| NOTIFICATION |||message1||||||userId|||||| Message5 I could not use space delimiter as in the messages I would be having them as... (2 Replies)
Discussion started by: Tomlight
2 Replies

10. Shell Programming and Scripting

Help with formatting

Hi, I am new to UNIX and need your help in formatting the below input command to the desire output Input: CREATE UNIQUE INDEX XPKTABLE1 ( COL1, COL2 ) ON TABLE_NM; Output: COMMENT ON TABLE DB_NM.TABLE_NM AS 'PK=,COL1,COL2; '; In... (14 Replies)
Discussion started by: varun2327
14 Replies
list_devices(1) 						   User Commands						   list_devices(1)

NAME
list_devices - list allocatable devices SYNOPSIS
list_devices [-s] [-U uid] [-z zonename] [-a [-w]] -l | -n | -u [device] | [-l | -n | -u] -c dev-class list_devices [-s] -d dev-type DESCRIPTION
The list_devices utility lists the allocatable devices in the system according to specified qualifications. The device and all device special files associated with the device are listed. The device argument is optional and, if it is not present, all relevant devices are listed. If dev-class is present, devices belonging to the specified dev-class are listed. There is no default dev- class. OPTIONS
The following options are supported: -l [-c dev-class | device] Lists the pathnames of the device special files associated with the device that are allocatable to the cur- rent process. If dev-class is specified, lists only the files associated with all devices of the specified device class. If device is specified, lists only the files associated with the specified device. -n [-c dev-class | device] Lists the pathnames of the device special files associated with the device that are allocatable to the cur- rent process but are not currently allocated. If dev-class is specified, lists only the files associated with all devices of the specified device class. If device is specified, lists only the files associated with the specified device. -s Silent. Suppresses any diagnostic output. -u [-c dev-class | device] Lists the pathnames of device special files associated with the device that are allocated to the owner of the current process. If dev-class is specified, lists only the files associated with all devices of the specified device class. If device is specified, lists only the files associated with the specified device. -U uid Uses the user ID uid instead of the real user ID of the current process when performing the list_devices operation. Only a user with the solaris.device.revoke authorization can use this option. The following options are supported when the system is configured with Trusted Extensions: -a Lists attributes like authorizations, cleaning programs and labels associated with a device. The list is a single line of semicolon (;) separated key=value pairs for each device in the format: device=device-name;type=device-type; auths=auths;clean=device-exec; device-attributes; files=device-list where device-attributes is the contents of the reserved1 field of device_allocate(4). The field is colon (:) separated.) See device_allocate(4) for a description of these attributes and their format. The -a output has the following keys: auths Specifies the list of authorizations. The value is auths is described in device_allocate(4). clean Specifies the device cleaning script. The value is device-exec as described in device_allocate(4). device Specifies the device name. The value is device-name as described in device_allocate(4). files Specifies the device file paths. The value is device-list as described in device_maps(4). type Specifies the device type. The value is device-type as described in device_allocate(4). -d Displays the system-supplied default attributes for the device types managed by device allocation. If dev-type is specified, it lists the default attributes for only that device type. -w This option can be used with -a to list the current owner of the device as the key value pair owner=value. value is the uid of the current owner of the device. If the device is unallocated, value is /FREE. If the device is in error state, value is /ERROR. This option also suppresses any diagnostic output. -z zonename When specified with the -l option, lists only those non-allocated devices whose label range includes the label of the zone- name, and of the allocated devices, only those that are allocated at the same label as that of zonename. When specified with the -n option, lists only those non-allocated devices whose label range includes the label of the zone- name. When specified with the -u option, lists only those devices that are allocated at the same label as that of zonename. EXAMPLES
Example 1 Listing All Devices The following example lists all devices available to the caller for allocation: % list_devices -l device: audio type: audio files: /dev/audio /dev/audioctl /dev/sound/0 /dev/sound/0ctl Example 2 Listing Attributes of All Devices On a system configured with Trusted Extensions, the following example lists attributes of all devices available to the caller for alloca- tion: % list_devices -al device=audio1;type=audio; auths=solaris.device.allocate; clean=/etc/security/lib/audio_clean; minlabel=admin_low:maxlabel=admin_high; files=/dev/audio1 /dev/audio1ctl /dev/sound/1 /dev/sound/1ctl Example 3 Listing Attributes Including the Device Owner On a system configured with Trusted Extensions, the following example lists attributes including the device owner of all devices allocated to the user: % list_devices -auw device=audio2;type=audio;auths=solaris.device.allocate; clean=/etc/security/lib/audio_clean; minlabel=admin_low:maxlabel=admin_high:zone=public; owner=1234; files=/dev/audio2 /dev/audio2ctl /dev/sound/2 /dev/sound/2ctl EXIT STATUS
The following exit values are returned: 0 Successful completion. 20 No entry for the specified device. other value An error occurred. FILES
/etc/security/device_allocate /etc/security/device_maps /etc/security/dev/* /usr/security/lib/* ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |Interface Stability |See below. | +-----------------------------+-----------------------------+ The invocation is Uncommitted. The options are Uncommitted. The output from the -a and -w options is Uncommitted. All other output is Not- an-Interface. SEE ALSO
allocate(1), deallocate(1), bsmconv(1M), dminfo(1M), mkdevalloc(1M), mkdevmaps(1M), device_allocate(4), device_maps(4), attributes(5) Controlling Access to Devices NOTES
The functionality described in this man page is available only if Solaris Auditing has been enabled. See bsmconv(1M) for more information. On systems configured with Trusted Extensions, the functionality is enabled by default. /etc/security/dev, mkdevalloc(1M), and mkdevmaps(1M) might not be supported in a future release of the Solaris Operating Environment. SunOS 5.11 30 Apr 2008 list_devices(1)
All times are GMT -4. The time now is 12:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy