Sponsored Content
Full Discussion: Perl script help
Top Forums Shell Programming and Scripting Perl script help Post 302760089 by Corona688 on Wednesday 23rd of January 2013 10:54:27 AM
Old 01-23-2013
Quote:
Originally Posted by bombcan
Thanks for the code however I need it in perl.
Even though it did in a simple one-line program what yours couldn't do in over 30? all right...
Quote:
And the output would have to add the MB used of all the filesystems in the particular VG (ex:rootvg) and then have a report reporting on

HOST VG TOTAL

I got as far as getting the total used of each filesystems
with this
my $free_space = (100 - $pct_used) * $alloc_mb;

Thanks
Think I see, now. Here is the awk version:

Code:
$ awk '{ sub(/%/, "", $4); A[$7] += ($3 * (100-$4))/100; } END { for(X in A) printf("%s, %d MB USED\n", X, A[X]) }' datafile

/usr/sap/transBWJ, 45158 MB USED
/usr/sap/ED1, 126 MB USED
/logs, 225 MB USED
/fixes, 35553 MB USED
/usr/sap/BX2/ASCS13, 952 MB USED
/usr/sap/EX1/ERS19, 880 MB USED
/usr/sap/hostagent_depot, 773848 MB USED
/var/adm/ras/livedump, 253 MB USED
/usr/sap/BD3/ASCS08, 890 MB USED
/tmp, 2027 MB USED
/usr/sap/EX1/W17, 696 MB USED
/usr/sap/WX1/ERS81, 819 MB USED
/proc, 0 MB USED
/var, 456 MB USED
/usr/sap/ED1/ERS04, 829 MB USED
/db2, 1013 MB USED
/sapmnt/BD3, 245366 MB USED
/archive, 217055 MB USED
/usr/sap/BD3/ERS09, 778 MB USED
/usr/sap/DAD, 4300 MB USED
/sapmnt/WX1, 245366 MB USED
/usr/sap/BD3, 126 MB USED
/, 201 MB USED
/sapmnt/EX1, 245366 MB USED
/cn_dev, 217055 MB USED
/IBMperfpmr, 1843 MB USED
/appl/rec, 217055 MB USED
/usr/sap/WX1, 126 MB USED
/usr, 883 MB USED
/usr/sap/EX1, 126 MB USED
/audit, 486 MB USED
/usr/sap, 4915 MB USED
/home, 486 MB USED
/usr/sap/BX2/ERS14, 808 MB USED
/opt, 87 MB USED
/admin, 126 MB USED
/usr/sap/EX1/SCS18, 665 MB USED
/usr/sap/WX1/W79, 706 MB USED
/appl/cyb_agent, 145 MB USED
/usr/sap/transBW, 45158 MB USED
/usr/sap/WX1/SCS80, 399 MB USED
/sapmnt/BX2, 245366 MB USED
/usr/sap/ED1/SCS03, 573 MB USED
/usr/sap/BX2/W12, 2764 MB USED
/usr/sap/BD3/W07, 2856 MB USED
/usr/sap/BX2, 126 MB USED
/sapmnt/ED1, 245366 MB USED
/usr/sap/ED1/W02, 696 MB USED

$

I'll get to work on converting that into perl...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl: Run perl script in the current process

I have a question regarding running perl in the current process. I shall demonstrate with an example. Look at this. sh-2.05b$ pwd /tmp sh-2.05b$ cat test.sh #! /bin/sh cd /etc sh-2.05b$ ./test.sh sh-2.05b$ pwd /tmp sh-2.05b$ . ./test.sh sh-2.05b$ pwd /etc sh-2.05b$ So... (10 Replies)
Discussion started by: vino
10 Replies

2. Shell Programming and Scripting

[Perl] Accessing array elements within a sed command in Perl script

I am trying to use a script to replace the header of each file, whose filename are stored within the array $test, using the sed command within a Perl script as follows: $count = 0; while ( $count < $#test ) { `sed -e 's/BIOGRF 321/BIOGRF 332/g' ${test} > 0`; `cat 0 >... (2 Replies)
Discussion started by: userix
2 Replies

3. Shell Programming and Scripting

perl/unix: script in command line works but not in perl

so in unix this command works works and shows me a list of directories find . -name \*.xls -exec dirname {} \; | sort -u | > list.txt but when i try running a perl script to run this command my $query = 'find . -name \*.xls -exec dirname {} \; | sort -u | > list.txt';... (2 Replies)
Discussion started by: kpddong
2 Replies

4. Shell Programming and Scripting

Perl :How to print the o/p of a Perl script on console and redirecting same in log file @ same time.

How can i print the output of a perl script on a unix console and redirect the same in a log file under same directory simultaneously ? Like in Shell script, we use tee, is there anything in Perl or any other option ? (2 Replies)
Discussion started by: butterfly20
2 Replies

5. Shell Programming and Scripting

HELP on Perl array / sorting - trying to convert Korn Shell Script to Perl

Hi all, Not sure if this should be in the programming forum, but I believe it will get more response under the Shell Programming and Scripting FORUM. Am trying to write a customized df script in Perl and need some help with regards to using arrays and file handlers. At the moment am... (3 Replies)
Discussion started by: newbie_01
3 Replies

6. Shell Programming and Scripting

calling a perl script with arguments from a parent perl script

I am trying to run a perl script which needs input arguments from a parent perl script, but doesn't seem to work. Appreciate your help in this regard. From parent.pl $input1=123; $input2=abc; I tried calling it with system("/usr/bin/perl child.pl $input1 $input2"); and `perl... (1 Reply)
Discussion started by: grajp002
1 Replies

7. Shell Programming and Scripting

executing perl script from another perl script : NOT WORKING

Hi Folks, I have 2 perl scripts and I need to execute 2nd perl script from the 1st perl script in WINDOWS. In the 1st perl script that I had, I am calling the 2nd script main.pl =========== print "This is my main script\n"; `perl C:\\Users\\sripathg\\Desktop\\scripts\\hi.pl`; ... (3 Replies)
Discussion started by: giridhar276
3 Replies

8. Shell Programming and Scripting

Perl : embedding java script with cgi perl script

Hi All, I am aware that html tags can be embedded in cgi script as below.. In the same way is it possible to embed the below javascript in perl cgi script ?? print("<form action="action.htm" method="post" onSubmit="return submitForm(this.Submitbutton)">"); print("<input type = "text"... (1 Reply)
Discussion started by: scriptscript
1 Replies

9. Shell Programming and Scripting

Excuting perl script from within a perl script with variables.

Not sure what I am doing wrong here, but I can print the list with no issue. Just a blank screen with the 'do'. #!/usr/bin/perl open FILE, "upslist.txt"; while ($line=<FILE>){ if ($line=~/^(.*?),(.*?)$/){ #print "ups:$1 string:$2\n"; do 'check_snmp_mgeups-0.1.pl -H $1 -C $2'; } ... (1 Reply)
Discussion started by: mrlayance
1 Replies

10. Programming

PERL: In a perl-scripttTrying to execute another perl-script that SETS SOME VARIABLES !

I have reviewed many examples on-line about running another process (either PERL or shell command or a program), but do not find any usefull for my needs way. (Reviewed and not useful the system(), 'back ticks', exec() and open()) I would like to run another PERL-script from first one, not... (1 Reply)
Discussion started by: alex_5161
1 Replies
llc1(7D)							      Devices								  llc1(7D)

NAME
llc1 - Logical Link Control Protocol Class 1 Driver SYNOPSIS
#include <sys/stropts.h> #include <sys/ethernet.h> #include <sys/dlpi.h> #include <sys/llc1.h> DESCRIPTION
The llc1 driver is a multi-threaded, loadable, clonable, STREAMS multiplexing driver supporting the connectionless Data Link Provider Interface, dlpi(7P), implementing IEEE 802.2 Logical Link Control Protocol Class 1 over a STREAM to a MAC level driver. Multiple MAC level interfaces installed within the system can be supported by the driver. The llc1 driver provides basic support for the LLC1 protocol. Func- tions provided include frame transmit and receive, XID, and TEST, multicast support, and error recovery and reporting. The cloning, character-special device, /dev/llc1, is used to access all LLC1 controllers configured under llc1. The llc1 driver is a "Style 2" Data Link Service provider. All messages of types M_PROTO and M_PCPROTO are interpreted as DLPI primitives. An explicit DL_ATTACH_REQ message by the user is required to associate the opened stream with a particular device (ppa). The ppa ID is interpreted as an unsigned long and indicates the corresponding device instance (unit) number. An error (DL_ERROR_ACK) is returned by the driver if the ppa field value does not correspond to a valid device instance number for this system. The values returned by the driver in the DL_INFO_ACK primitive in response to the DL_INFO_REQ from the user are as follows: o The maximum Service Data UNIT (SDU) is derived from the MAC layer linked below the driver. In the case of an Ethernet driver, the SDU will be 1497. o The minimum SDU is 0. o The MAC type is DL_CSMACD or DL_TPR as determined by the driver linked under llc1. If the driver reports that it is DL_ETHER, it will be changed to DL_CSMACD; otherwise the type is the same as the MAC type. o The sap length value is -1, meaning the physical address component is followed immediately by a 1-octet sap component within the DLSAP address. o The service mode is DL_CLDLS. o The MAC type is DL_CSMACD or DL_TPR as determined by the driver linked under llc1. If the driver reports that it is DL_ETHER, it will be changed to DL_CSMACD; otherwise the type is the same as the MAC type. o The dlsap address length is 7. o No optional quality of service (QOS) support is included at present, so the QOS fields should be initialized to 0. o The DLPI version is DL_VERSION_2. o The provider style is DL_STYLE2. o The broadcast address value is the broadcast address returned from the lower level driver. Once in the DL_ATTACHED state, the user must send a DL_BIND_REQ to associate a particular Service Access Point (SAP) with the stream. The llc1 driver interprets the sap field within the DL_BIND_REQ as an IEEE 802.2 "SAP," therefore valid values for the sap field are in the [0-0xFF] range with only even values being legal. The llc1 driver DLSAP address format consists of the 6-octet physical (e.g., Ethernet) address component followed immediately by the 1-octet sap (type) component producing a 7-octet DLSAP address. Applications should not hard-code to this particular implementation-spe- cific DLSAP address format, but use information returned in the DL_INFO_ACK primitive to compose and decompose DLSAP addresses. The sap length, full DLSAP length, and sap/physical ordering are included within the DL_INFO_ACK. The physical address length can be computed by subtracting the absolute value of the sap length from the full DLSAP address length or by issuing the DL_PHYS_ADDR_REQ to obtain the cur- rent physical address associated with the stream. Once in the DL_BOUND state, the user may transmit frames on the LAN by sending DL_UNITDATA_REQ messages to the llc1 driver. The llc1 driver will route received frames up all open and bound streams having a sap which matches the IEEE 802.2 DSAP as DL_UNITDATA_IND mes- sages. Received frames are duplicated and routed up multiple open streams if necessary. The DLSAP address contained within the DL_UNIT- DATA_REQ and DL_UNITDATA_IND messages consists of both the sap (type) and physical (Ethernet) components. In addition to the mandatory, connectionless DLPI message set, the driver additionally supports the following primitives: The DL_ENABMULTI_REQ and DL_DISABMULTI_REQ primitives enable/disable reception of specific multicast group addresses. A set of multicast addresses may be iteratively created and modified on a per-stream basis using these primitives. These primitives are accepted by the driver in any driver state that is valid while still being attached to the ppa. The DL_PHYS_ADDR_REQ primitive returns the 6-octet physical address currently associated (attached) to the stream in the DL_PHYS_ADDR_ACK primitive. This primitive is valid only in states following a successful DL_ATTACH_REQ. The DL_SET_PHYS_ADDR_REQ primitive changes the 6-octet physical address currently associated (attached) to this stream. Once changed, all streams subsequently opened and attached to this device will obtain this new physical address. Once changed, the physical address will remain set until this primitive is used to change the physical address again or the system is rebooted, whichever occurs first. The DL_XID_REQ/DL_TEST_REQ primitives provide the means for a user to issue an LLC XID or TEST request message. A response to one of these messages will be in the form of a DL_XID_CON/DL_TEST_CON message. The DL_XID_RES/DL_TEST_RES primitives provide a way for the user to respond to the receipt of an XID or TEST message that was received as a DL_XID_IND/DL_TEST_IND message. XID and TEST will be automatically processed by llc1 if the DL_AUTO_XID/DL_AUTO_TEST bits are set in the DL_BIND_REQ. FILES
/dev/llc1 cloning, character-special device ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Architecture |x86 | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5), dlpi(7P) SunOS 5.10 13 Feb 1997 llc1(7D)
All times are GMT -4. The time now is 01:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy