Perl script to find last column


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Perl script to find last column
# 1  
Old 03-27-2015
Perl script to find last column

Dear all,

I am new bee in perl scripting,i have generated one report in which i want to paste some data/text at the end,plz help me

format is like this
Code:
$worksheet1->write( 'A5',[\@data1],$format2);

Quote:
COL A5 1 2 3 4 5 6
.
.
.

COL A50 a b c d e
i want to paste my text after this column A50 in column A51 but this column is variable it may change

Code:
$worksheet1->merge_range('A51:G51',"New data to be pasted here",$format10);

so how to find out and implement this last column number and where the new data is to be pasted ( just next cell )
# 2  
Old 03-28-2015
Quote:
Originally Posted by sagar_1986
...
i want to paste my text after this column A50 in column A51 but this column is variable it may change

Code:
$worksheet1->merge_range('A51:G51',"New data to be pasted here",$format10);

...
The range for merge_range() does not have to be hard-coded.
If you can derive the value 51 from your data, then you can create the first argument of merge_range() dynamically and pass that to the method.

Code:
$range = "A".$last_col.":G".$last_col;  # $last_col = 51
$worksheet1->merge_range($range, "New data to be pasted here", $format10);

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl find and add to column

Hi, Could you help me with script in perl ;A1;AAA;%/A/B;70;75;-; ;A1;AAA;%/A/C;70;75;-; ;A1;BBB;%/A/G;70;75;-; ;A1;BBB;%/A;70;75;-;I would like to find line with '%/A' and put in that line in column 5 and 6 some other value ex: 90 and 99 example output: ;A1;AAA;%/A/B;70;75;-;... (5 Replies)
Discussion started by: vikus
5 Replies

2. UNIX for Dummies Questions & Answers

Perl Script:how to find how many parameters are required to run the script

How to find how many parameters are required to run a Perl script? (1 Reply)
Discussion started by: Lakshman_Gupta
1 Replies

3. Homework & Coursework Questions

Script to find difference between 2 files by column

Hi , i am newbie to shell scripting and am trying to do the below job, A shell script to be run with a command like sh Compare.ksh file1.txt file2.txt 1 2 > file3.txt 1 2-are the key columns Consider the delimiter would be Tab or comma File 1: SK TEST NAME MATHS PHYSICS 21 1 AAA... (1 Reply)
Discussion started by: shakthi666
1 Replies

4. Shell Programming and Scripting

Script to find difference between 2 files by column

Hi , i am newbie to shell scripting and am trying to do the below job, A shell script to be run with a command like sh Compare.ksh file1.txt file2.txt 1 2 > file3.txt 1 2-are the key columns Consider the delimiter would be Tab or comma File 1: SK TEST NAME MATHS PHYSICS 21 1... (1 Reply)
Discussion started by: shakthi666
1 Replies

5. Shell Programming and Scripting

Perl script to extract second column from a xls

Can Anyone tell me how to extract the second column of a xls sheet And compare the content of each row of the column with a .h file. xls sheet is having only one spreadsheet. (2 Replies)
Discussion started by: suvenduperl
2 Replies

6. Shell Programming and Scripting

Cut the first column in listed files > PERL script

Hi All, Using this command wc -l *e* > create2.txt i'm getting the following output >>>create2.txt listed output files, my requirement is how to cut the first coloum in all the files mentioned in create2.txt in perl. 50 allignment.pl 3 create.txt 4 application.txt ... (8 Replies)
Discussion started by: adaleru
8 Replies

7. Shell Programming and Scripting

Script to find the average of a given column and also for specified number of rows?

Hi Friends, In continuation to my earlier post https://www.unix.com/shell-programming-scripting/99166-script-find-average-given-column-also-specified-number-rows.html I am extending my problem as follows. Input: Column1 Column2 MAS 1 MAS 4 ... (2 Replies)
Discussion started by: ks_reddy
2 Replies

8. Shell Programming and Scripting

Help need to write a script on column separation for syslog output in perl

HI Pros, I have a issue.I need to write a script to parse the logs got from syslog server and update the same in my database.I need the following output.I donot know perl and I heard it very easy to write in perl I have the sample log I need each column seperated by commas and all equals... (0 Replies)
Discussion started by: iron_michael86
0 Replies

9. Shell Programming and Scripting

Script to find the average of a given column and also for specified number of rows??

Hi friends I have 100 files in my directory. Each file look like this.. Temp1 Temp2 Temp3 MAS 1 2 3 MAS 4 5 6 MAS 7 8 9 Delhi 10 11 12 Delhi 13 14 15 Delhi 16 17 ... (4 Replies)
Discussion started by: ks_reddy
4 Replies

10. Shell Programming and Scripting

script to compare first column of two files and find difference

Hi, I want to write a script which will compare the 1st column of both the files and will give the difference. e.g:- my 1st file contains: 89 /usr 52 /usr/local 36 /tmp 92 /opt 96 /home 27 /etc/opt/EMCom 1 ... (3 Replies)
Discussion started by: adityam
3 Replies
Login or Register to Ask a Question