saketh_hunk has asked for the wisdom of the Perl Monks concerning the following question:
Hi All, I am trying to write a perl script which shows the report like a table with below details: Branch Name: FileName changed| Author | revision number of the file 1)we use SVN as our version control tool, so our intention is to use svn commands and generate a basic report and then use perl script to neatly organize it. I am unable to allign the output as a table. Expected result: Branch Name: release_1 FileName Changed| Author | Revision Number of file changed| hello1.c | saketh1 | r120 hello2.c | saketh2 | r12 hello3.c | saketh3 | r100 Current/ERROR OUTPUT: Branch Name: release_1 FileName Changed| Author | Revision Number of file changed| hello1.c | saketh1 | r120 hello2.c | saketh2 | r12 hello1.c | saketh3 | r100
#!/usr/local/bin/perl require "List/MoreUtils.pm"; use strict; use List::MoreUtils qw(:all); my @FilePath=`svn log RepoUrl -v -q | awk '/paths/ { getline; print $1 + }'| awk -F' ' '{print \$2}'|awk -F'/' '{print \$NF}'`; my @Author=`svn log RepoUrl -q | awk -F'|' '{print \$2}'| awk 'NF' `; my @Revision=`svn log RepoUrl -q | awk -F'|' '{print \$1}'| sed 's/'-' +//g'| awk 'NF' `; my $branch=`svn info RepoUrl | grep ^URL | awk -F'/' '{print \$NF}'`; printf " Branch : $branch + \n" +; printf "|============================================================ +===================================================================== +=======|\n"; printf "| %-35s | %-35s | %-35s \n"," FILENAME ", " AUTHOR "," + VERSION "; printf "|============================================================ +===================================================================== +=======|\n"; my $result = each_array(@FilePath, @Author, @Revision); while ( my ($a, $b, $c) = $result->() ) { printf "$a"."\t"."$b"."\t"."$c"; } printf "|============================================================ +===================================================================== +=======|\n"; Expected result: Branch Name: release_1 FileName Changed| Author | Revision Number of file change +d| hello1.c | saketh1 | r120 hello2.c | saketh2 | r12 hello3.c | saketh3 | r100 Current/ERROR OUTPUT: Branch Name: release_1 FileName Changed| Author | Revision Number of file change +d| hello1.c | saketh1 | r120 hello2.c | saketh2 | r12 hello1.c | saketh3 | r100
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: print a tabular report using perl
by toolic (Bishop) on Jan 12, 2016 at 18:12 UTC | |
|
Re: print a tabular report using perl
by Ratazong (Monsignor) on Jan 12, 2016 at 18:12 UTC | |
|
Re: print a tabular report using perl
by Mr. Muskrat (Canon) on Jan 12, 2016 at 18:33 UTC | |
|
Re: print a tabular report using perl
by kennethk (Abbot) on Jan 13, 2016 at 00:04 UTC | |
|
Re: print a tabular report using perl
by poj (Abbot) on Jan 12, 2016 at 18:25 UTC | |
|
Re: print a tabular report using perl
by hotchiwawa (Scribe) on Jan 12, 2016 at 18:01 UTC | |
by saketh_hunk (Initiate) on Jan 12, 2016 at 18:15 UTC | |
by GotToBTru (Prior) on Jan 12, 2016 at 18:58 UTC |