Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Thread Tools Display Modes
Old 24th April 2007, 16:59
pnsreee pnsreee is offline
Junior Member
Join Date: Apr 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up Getting columns from csv file in perl

Hi All,

How can i get columns from cvs file into an array with out using Text::xSV or Text::CSV_XS.
The CSV file is a dynamic file.

the fields are like this





I am using following code to get columns.

@tmp = `more +2 flat1.txt | cut -d "," -f $i` ;

It is giving out put and also error saying that refer help.
Can any one give me equivalent to this
Reply With Quote
Sponsored Links
Old 24th April 2007, 17:48
ghostdog74 ghostdog74 is offline
Junior Member
Join Date: Aug 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts

you are using perl, and then you are using other OS tools like more and cut. this is overkill. in perl , you can split your string eg perldoc -f split, you can see how its done. if you want to use shell tools, awk can do that.

Last edited by ghostdog74; 24th April 2007 at 17:52.
Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chroot SSH + ISPConfig Norman Installation/Configuration 27 26th March 2007 04:40
Dspam planet_fox General 6 20th January 2007 19:42
Systemimager (rsync) doesn't copy all comedit HOWTO-Related Questions 11 19th January 2007 18:17
HotSaNIC domino Tips/Tricks/Mods 23 6th November 2006 06:19
jamed up my table borders?? Boon-Dog-Danny Installation/Configuration 5 23rd September 2006 17:12

All times are GMT +2. The time now is 04:31.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.