Reading specific range of columns in an Excel file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Reading specific range of columns in an Excel file
# 1  
Old 12-17-2014
Reading specific range of columns in an Excel file

Hi All,

I want to read an excel file.

PFA excel, I want to read the cloumn from A to G and the V to AH
starting from Row number 3.

Please help me on this.
# 2  
Old 12-17-2014
Hello Abhisrajput,

Following may help you in same.
Code:
awk '{$8=$9=$10=$11=$12=$13=$14=$15=$16=$17=$18=$19=$20=$21=""} 1' Input_file

Thanks,
R. Singh
# 3  
Old 12-17-2014
That can't be done on binary files with normal text utilities. Save as e.g. .csv formatted text file to enable that.
There may be perl modules that can solve your problem.
# 4  
Old 12-17-2014
Sometimes apps save csv files with an .xls suffix, so the associate to excel. Otherwise, to batch process them, you need to write in PERL, VB or get them into csv or txt form: How to convert excel file to csv file or text file?
# 5  
Old 12-18-2014
Code:
#!/usr/bin/perl
use strict;
use warnings;
open my $fh, '<', 'CF_Resourcing' or die "Can't open file: $!\n";
while (<$fh>) {
    my @fields = split(/\t/);
    print "@fields[0,1,3,4,5,6,21,22,23,24,25,26,27,28,29,30,31,32,33]\n";
}


Last edited by Franklin52; 12-30-2014 at 07:59 AM.. Reason: Please use code tags
# 6  
Old 12-18-2014
Just filter rows and columns after the "for each row/column".
# 7  
Old 12-22-2014
Quote:
Originally Posted by DGPickett
Just filter rows and columns after the "for each row/column".
Can you please help me with that. I am very new into Perl.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Trouble reading from a tab delimited excel file

So I have a file1.txt that is tab delimited: e.g. FIELD1 FIELD2 FIELD3 FIELD4 FIELD5 9545641 123 "Neighbor and Labrador,Canada" 54895 'CANADA' 9456465 456 "Neighbor and Labrador,Canada" 54893 'CANADA' 8746512 789 "Neighbor and... (11 Replies)
Discussion started by: dan139
11 Replies

2. Shell Programming and Scripting

Perl script to accept specific columns from excel

Hi All, I have below perl script which writes xml from .xls file. Now i want to add below two conditions in this script : 1. to check if the the input .xls file has ony two columns , if more tahn two columns then script should pop up an error. 2. If there are two columns , then first column... (4 Replies)
Discussion started by: omkar.jadhav
4 Replies

3. Shell Programming and Scripting

Need specific columns in a log file as excel.

Hi All... I am in need of few columns from a log file.. in .xls file... below is what i have tried. my log file has 16 colums with " ; " as delimiter, but i need randomn columns 1 2 3 4 5 6 10 11 16 in an excel. I tried to awk the columns with delimiter ; and it worked, below is the log... (5 Replies)
Discussion started by: nanz143
5 Replies

4. UNIX for Dummies Questions & Answers

Search for a specific String in a log file for a specific date range

Hi, I have log file which rolls out every second which is as this. HttpGenRequest - -<!--OXi dbPublish--> <created="2014-03-24 23:45:37" lastMsgId="" requestTime="0.0333"> <response request="getOutcomeDetails" code="114" message="Request found no matching data" debug="" provider="undefined"/>... (3 Replies)
Discussion started by: karthikprakash
3 Replies

5. UNIX for Dummies Questions & Answers

How to delete columns with numbers in an excel file?

Dear all, I have one file (see below) with more then 100 columns and 2500 rows, and need only column which has GType in label with Alphabets, please help me to remove these columns with numbers. input file is n.201.GType n-201.Theta n-201.R n_1.GType n_1.Theta n_1.R... (6 Replies)
Discussion started by: AAWT
6 Replies

6. Shell Programming and Scripting

finding file with a specific range

Hi All, Thanks in advance File is generated with following format 31000000.xml to 48999999.xml 74000000.xml to 88999999.xml Above range should be find and moved into the folder named abc and below is another range should should be find and moved into folder named xyz ... (1 Reply)
Discussion started by: sujit_kashyap
1 Replies

7. UNIX for Advanced & Expert Users

Finding a specific range of character in file

hi, I want to store from 102 character to 128 character to a variable of header record which can be identified as 'HDR' which is the first 3 characters in the same line of a same.txt file. Please advise. Thanks (4 Replies)
Discussion started by: techmoris
4 Replies

8. UNIX for Dummies Questions & Answers

To compare first two columns in an excel file

Hi All, i have a excel sheet with two columns as below. column1 column2 100 100 200 300 300 400 400 400 500 600 i need to compare the values these two columns and the output should be printed in the third column...if these values are equal the output should be green and if these... (2 Replies)
Discussion started by: arunmanas
2 Replies

9. Shell Programming and Scripting

How to sort columns in excel(csv) file

i want sort columns with headers based on another file headers file1 eg: i'm having an empty file with only coumn names like lastname firstname title expirydate stlcno status etc... another file with same column names and some other as well but in different order... file2 eg:firstname... (2 Replies)
Discussion started by: Man83Nagesh
2 Replies

10. Shell Programming and Scripting

how to convert fields from a text file to excel columns

i have this file which has the following contents: ,-0.3000 ,-0.3000 ,-0.3000 ,-0.9000 ,-0.9000 ,-0.9000 i would like to get this: -0.3-0.9-0.3-0.9-0.3-0.9 so far i am trying: awk '{for(i=1; i<=NF; i++) {printf("%f\n",$i)}}' test1 > test2 any help... (4 Replies)
Discussion started by: npatwardhan
4 Replies
Login or Register to Ask a Question