By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,359 Members | 1,481 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,359 IT Pros & Developers. It's quick & easy.

Tab limited file manipulation in PERL

P: 5
Hai i have a tab limited file (see the attachment 1.xls) and i want to extract only 2,7,8 columns(2.xls) how it possible with a perl code
Attached Files
File Type: xls 1.xls (376 Bytes, 124 views)
File Type: xls 2.xls (98 Bytes, 105 views)
Sep 17 '16 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 100+
P: 589
Open a read filehandle to the source file and a write filehandle to the output file.

Loop over the source file line-by-line and use the split() function to put the fields into an array and then output the desired 3 array elements to the output filehandle.

There are several variations on how to do each step and there are modules available, such as Text::CSV_XS, to help but using the module would not be required.
Sep 17 '16 #2

Post your reply

Sign in to post your reply or Sign up for a free account.