how to get the Format header in perl in different color


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to get the Format header in perl in different color
# 1  
Old 01-24-2011
how to get the Format header in perl in different color

Now here is the problem
how to get the Format header in perl in different color.

HTML Code:
             format RPT_TOP=
                                DINISO EXECUTION REPORT
@<<<<<<<<<<<<<         AGAINST SEOPACTUAL           Page : @>>>
$TODAY,$%
----------------------------------------------------------------------
Output field      Values       Actual values         Status
----------------------------------------------------------------------
.
# define the page
format RPT=
@<<<<<<<<<<<<<<<<<<<<   @<<<<<<<<<<    @>>>>>>>>>>>       @>>>>>>>>>
$DOF, $V, $SV, $S
.
I want the Header Top to come in colored i.e. what u get by using Term::ANSIColor;
Any help is Appreciated.........
# 2  
Old 01-24-2011
Each TERM has its own control sequences to change colors -- one of the reasons they invented HTML. You could do it in HTML and browse it with lynx. Otherwise, research the control strings of your term. Does PERL have something like curses to deal with terminal variations?
# 3  
Old 01-24-2011
Perhaps you should try sprintf instead of format, you should then be able to use the Term::ANSIColor features

Code:
#!/usr/bin/perl
use warnings;
use strict;
use Term::ANSIColor;
 
print colored( sprintf("%-20.20s   %-12.12s    %12.12s", 'Field', 'Value', 'Actual'), 'blue' ), "\n";


Last edited by Chubler_XL; 01-24-2011 at 06:06 PM.. Reason: Added an example using ANSIColor sprintf
# 4  
Old 01-25-2011
Question Thanks Chubler 4 ur reply

Thanks Chubler 4 ur reply.. But what I am tryin to achive here is to generate a report which comes as a minimum of 30 pages with page no indexing and with [ write $DOF, $V, $SV, $S; ] I can get the values printed with a well formated way i.e. having the Format top recurring every time the page length out occures and if I follow ur suggested way it would be difficult to incorporate all what I need.

Although it is not absolutely necessary to get the format header in colored but it certainly will make my report look good.

Awaiting ur reply......
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

perl module to convert xlsx format to xls format

Hi Folks, I have written a perl script that reads data from excel sheet(.xls) using Spreadsheet::ParseExcel module. But the problem is this module doesn't work for excel sheets with extension .xlsx. I have gone through Spreadsheet::XLSX module with which we can read from .xlsx file directly.... (1 Reply)
Discussion started by: giridhar276
1 Replies

2. Shell Programming and Scripting

color print using perl

Hi i want to print the text in different color using perl script. i am able to print on console(terminal). but if i try to print the same into a file, i am not able to do color.pl #!/bin/usr/perl use Term::ANSIColor; print "This text is normal.\n"; use Term::ANSIColor qw(:constants);... (3 Replies)
Discussion started by: roopa
3 Replies

3. Shell Programming and Scripting

creating color palette using awk or perl

Hi, I'm wondering if anyone have tried creating a color palette or table using awk or perl using a range of values. thanks for any suggestion in advance. 0-0.1: purple 0.1-0.2: blue 0.2-0.3: green 0.3-0.4: yellow 0.4-0.5: orange > 0.5: red Happy holidays,:) (5 Replies)
Discussion started by: ida1215
5 Replies

4. Shell Programming and Scripting

Perl array with row header

Here is the csv file file i have: ServerName, IPAddress, Gateway, Notes ServerA, 192.168.1.100, 192.168.1.1, This is some server ServerB, 192.168.1.110, 192.168.1.1, This is some other server ServerC, 192.168.1.120, 192.168.1.1, This is some other other server I would like to have the... (6 Replies)
Discussion started by: Ikon
6 Replies

5. Shell Programming and Scripting

Get header and its matched value in perl?

Hi, I have the file contents: Start,End,Req,Resp 12:39,12:40,4,5 The sting to be matched is: Req and Resp. parsefile("Req,Resp"); Here is the code. sub parsefile ($) { $header=shift; (2 Replies)
Discussion started by: vanitham
2 Replies
Login or Register to Ask a Question