Sponsored Content
Top Forums Shell Programming and Scripting Help with perl script to output data in table format... Post 302650213 by pravin27 on Friday 1st of June 2012 10:35:13 PM
Old 06-01-2012
Code:
#!/usr/bin/perl

use strict;
my $prof;
$/="\n\n";
print "Virtual Server          Profiles \n";

while (<DATA>) {
if (/virtual\s+(.*?)\s*\{(.*?)profiles\s*\{(.*?)\s*\{(.*?)\}(.*)\}(.*)vlans/sg) {
        my $ser=$1;
        $prof=$3;
        chomp $prof;
        my $str=$5;
        $prof=~s/^\s+//g;       $prof=~s/\s+$//g;
        $str=~s/^\s+//g;        $str=~s/\s+$//g;
        $str=~s/[\{\}]//g;      $str=~s/\n/,/g; $str=~s/,\s+/,/g;
        print $ser,"\t\t",$prof,",",$str,"\n";
        }
}

__DATA__
monitor Test-ICMP4 {
   defaults from icmp
   dest 10.2.34.81
   transparent
virtual VS-Bridge1 {
   snatpool SNAT-IP-Banorte
   pool Bridge1-pool
   destination 10.2.33.102:vpad
   ip protocol tcp
   rules iRule-Bridge1-Logging
   profiles {
      Bridge1_SSL_Profile {
         serverside
      }
      fastl4 {}
   }
   vlans {
      External-VLAN
      PlanetSwitch-VLAN
   } enable
}

virtual VS-Bridge_test {
   destination 10.2.33.59:https
   ip protocol tcp
   rules {
      iRule-testLogging
   }
   profiles {
      SECURE2_SSL_Profile {
         clientside
      }
      http {}
      stream {}
      tcp {}
   }
   vlans {
      External-VLAN
      Internal-VLAN
   } enable

OR
Code:
#!/usr/bin/perl

use strict;
my $prof;
$/="virtual";
print "Virtual Server          Profiles \n";

while (<DATA>) {
if (/(.*?)\s*\{(.*?)profiles\s*\{(.*?)\s*\{(.*?)\}(.*)\}(.*)vlans/sg) {
        my $ser=$1;
        $prof=$3;
        chomp $prof;
        my $str=$5;
        $prof=~s/^\s+//g;       $prof=~s/\s+$//g;
        $str=~s/^\s+//g;        $str=~s/\s+$//g;
        $str=~s/[\{\}]//g;      $str=~s/\n/,/g; $str=~s/,\s+/,/g;
        print $ser,"\t\t",$prof,",",$str,"\n";
        }
}

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to print out data from mysql table in perl script

I'm having trouble with this code. if i do .\read.pl -u user it prints out 2010-12-20 12:00:00 host1 <cmd>a 2010-12-20 12:00:01 host1 <cmd> <execute> 2010-12-20 12:00:02 host1 <cmd>b 2010-12-20 12:00:03 host1 <cmd>c however, if i enter .\read.pl -h host1 it should... (3 Replies)
Discussion started by: kpddong
3 Replies

2. Shell Programming and Scripting

Perl Script for reading table format data from file.

Hi, i need a perl script which reads the file, content is given below. and output in new file. TARGET DRIVE IO1 IO2 IO3 IO4 IO5 ------------ --------- --------- --------- --------- --------- 0a.1.8 266 236 ... (3 Replies)
Discussion started by: asak
3 Replies

3. Shell Programming and Scripting

convert the output in table format

Hi All, I have a output like below values val1=test.com val2=10.26.208.11 val3=en1 val4=test-priv1.com val5=192.168.3.4 val6=en2 val7=test-priv2.com val8=192.168.4.4 val9=en3 val10=test-vip.com val11=10.26.208.9 val12=$val3 I want to convet this output values into below... (1 Reply)
Discussion started by: kamauv234
1 Replies

4. Shell Programming and Scripting

Represent the data in table format as in mail content

hi all, I want to Represent the data in table format in mail content sample data should be like this...but i m trying to send this table to mail using unix command...hw do i do????even i echoed the table contents ...doesnt work.... help me <table style="background-color:lightblue;">... (8 Replies)
Discussion started by: navsan
8 Replies

5. Shell Programming and Scripting

Output in table format

I have one script which generate file called report.txt having following output parameter_name status comment banking ok NA finance 30% hike NA Loan_department ok 20% HR_Group defaulters Ajay I wanted to convert this file into tabular form. You can see each line contain 3 words and... (7 Replies)
Discussion started by: Nakul_sh
7 Replies

6. Shell Programming and Scripting

Perl -- Script to re-format data

Hi, I have a file with data in the following format BOX -1.000000 -1.000000 0.000000 30.00000 14.00000 0.1000000 0.000000 0.000000 0.000000 0.000000 0.000000 CYLINDER 3.595000 2.995000 0.000000 0.5100000 2.000000 Z 0.000000 0.000000 0.000000 I want to convert these files... (1 Reply)
Discussion started by: lost.identity
1 Replies

7. Shell Programming and Scripting

Script to generate Excel file or to SQL output data to Excel format/tabular format

Hi , i am generating some data by firing sql query with connecting to the database by my solaris box. The below one should be the header line of my excel ,here its coming in separate row. TO_CHAR(C. CURR_EMP_NO ---------- --------------- LST_NM... (6 Replies)
Discussion started by: dani1234
6 Replies

8. Shell Programming and Scripting

Need the output in the mentioned Table format

Hi Friends, I have the script output like below: Script Output: ----------------------------------------------------------------------- Details of the Client: ----------------------- name: server1; save set: All; ... (3 Replies)
Discussion started by: akmani
3 Replies

9. Shell Programming and Scripting

Arranging the command output into an html table format

Hi, I need to format a command output for the beolow command: runmqckm -cert -list -db $MQ_KDB -pw $PASSWD -expiry $EXP | grep -v "Certificates in database" The output will be: "ABC - cert name" From: Tuesday, May 25, 1999 11:09:40 AM CDT To: Saturday, May 25, 2019 11:39:40 AM CDT ... (3 Replies)
Discussion started by: bdpl
3 Replies

10. Shell Programming and Scripting

Shell output format like table

Hi, OS: Redhat 7.5 shell: Bash Wrote below script to login into oracle via shell script and trying to reset locked account..It works as expected. But I need specific output << EOF should go to target terminal not all out put running below script from ansible command line.. #!/bin/bash... (1 Reply)
Discussion started by: onenessboy
1 Replies
asadmin-list-virtual-servers(1AS)				   User Commands				 asadmin-list-virtual-servers(1AS)

NAME
asadmin-list-virtual-servers, list-virtual-servers - gets the virtual servers SYNOPSIS
list-virtual-servers --user admin_user [--password admin_password] [--host localhost] [--port 4848] [--secure|-s] [--passwordfile filename] [--terse=false] [--echo=false] [--interactive=true] Gets all the virtual server elements. This command is supported in remote mode only. OPTIONS
--user authorized domain application server administrative username. --password password to administer the domain application server. --host machine name where the domain application server is running. --port port number of the domain application server listening for administration requests. --secure if true, uses SSL/TLS to communicate with the domain application server. --passwordfile file containing the domain application server password. --terse indicates that any output data must be very concise, typically avoiding human-friendly sentences and favoring well- formatted data for consumption by a script. Default is false. --echo setting to true will echo the command line statement on the standard output. Default is false. --interactive if set to true (default), only the required password options are prompted. Example 1: Using list-virtual-servers asadmin> list-virtual-servers --user admin --password adminadmin --host localhost --port 4848 Command list-virtual-servers executed successfully EXIT STATUS
0 command executed successfully 1 error in executing the command asadmin-create-virtual-server(1AS), asadmin-delete-virtual-server(1AS) J2EE 1.4 SDK March 2004 asadmin-list-virtual-servers(1AS)
All times are GMT -4. The time now is 09:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy