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
PROF(1) 						      General Commands Manual							   PROF(1)

NAME
prof, kprof - display profiling data SYNOPSIS
prof [ -dr ] [ program ] [ profile ] kprof kernel kpdata DESCRIPTION
Prof interprets files produced automatically by programs loaded using the -p option of 2l(1) or other loader. The symbol table in the named program file by default) is read and correlated with the profile file by default). For each symbol, the percentage of time (in sec- onds) spent executing between that symbol and the next is printed (in decreasing order), together with the time spent there and the number of times that routine was called. Under option -d, prof prints the dynamic call graph of the target program, annotating the calls with the time spent in each routine and those it calls, recursively. The output is indented two spaces for each call, and is formatted as symbol:time/ncall where symbol is the entry point of the call, time is in milliseconds, and ncall is the number of times that entry point was called at that point in the call graph. If ncall is one, the /ncall is elided. Normally recursive calls are compressed to keep the output brief; option -r prints the full call graph. The size of the buffer in program used to hold the profiling data, by default 2000 entries, may be controlled by setting the environment variable profsize before running program. If the buffer fills, subsequent function calls may not be recorded. Kprof is similar to prof, but presents the data accumulated by the kernel profiling device, kprof(3). The symbol table file, that of the operating system kernel, and the data file, typically /dev/kpdata, must be provided. Kprof has no options and cannot present dynamic data. SOURCE
/sys/src/cmd/prof.c /sys/src/cmd/kprof.c SEE ALSO
2l(1), kprof(3) PROF(1)
All times are GMT -4. The time now is 10:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy